01: package demo.bank.concurrency;
02:
03: import org.omg.CORBA.*;
04: import org.omg.CORBA.ORBPackage.*;
05: import org.omg.CosTransactions.*;
06: import org.omg.CosNaming.*;
07: import java.io.*;
08:
09: import org.jacorb.concurrency.*;
10: import org.jacorb.transaction.*;
11:
12: public class Server {
13: public static void main(String[] args) {
14: org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
15: try {
16: org.omg.PortableServer.POA poa = org.omg.PortableServer.POAHelper
17: .narrow(orb.resolve_initial_references("RootPOA"));
18:
19: poa.the_POAManager().activate();
20:
21: NamingContextExt nc = NamingContextExtHelper.narrow(orb
22: .resolve_initial_references("NameService"));
23: NameComponent[] name = new NameComponent[1];
24:
25: TransactionService.start(poa, 100);
26: name[0] = new NameComponent("TransactionService", "service");
27: nc.bind(name, TransactionService.get_reference());
28:
29: LockSetFactoryImpl lsf = new LockSetFactoryImpl(poa);
30: name[0] = new NameComponent("ConcurrencyControlService",
31: "service");
32:
33: nc.bind(name, poa.servant_to_reference(lsf));
34:
35: org.omg.CORBA.Object o = poa
36: .servant_to_reference(new BankImpl(orb, poa));
37: name[0] = new NameComponent("DigiBank", "server");
38: nc.bind(name, o);
39:
40: orb.run();
41:
42: } catch (Exception e) {
43: e.printStackTrace();
44: }
45: }
46:
47: }
|