ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.vci.server.workflow.server;
 
import org.omg.PortableServer.POA;
import org.omg.PortableServer.Servant;
 
import com.vci.common.log.ServerWithLog4j;
import com.vci.server.base.corbautil.NameServiceUtility;
 
public class WorkFlowServer {
    //protected static NameServiceUtility nsu = null;
    private static String WFSERVICENAME = "wfService";
    
    /**
     * @param args
     */
    public static void main(String[] args) {
        try
        {
//            nsu = new NameServiceUtility();
//            nsu.InitORBEnv();
//            nsu.InitORB();
//            nsu.InitNameContext();
//            POA poa = nsu.getPoa();
//            
//            Servant ob =(Servant) (new WorkflowServiceImpl());
//            poa.activate_object(ob);
//            nsu.bindToNs(WFSERVICENAME, poa.servant_to_reference(ob));
//            ServerWithLog4j.logger.info("bind " + WFSERVICENAME + " OK!");
//
//            nsu.getOrb().run();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            clearAll();
            nsu.close();
        }
 
    }
 
    /**
     * 解除绑定工作流Corba服务
     */
    protected static void clearAll()
    {
        try
        {
            nsu.unBindToNs(WFSERVICENAME);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}