KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > bank > concurrency > Server


1 package demo.bank.concurrency;
2
3 import org.omg.CORBA.*;
4 import org.omg.CORBA.ORBPackage.*;
5 import org.omg.CosTransactions.*;
6 import org.omg.CosNaming.*;
7 import java.io.*;
8
9 import org.jacorb.concurrency.*;
10 import org.jacorb.transaction.*;
11
12 public class Server
13 {
14     public static void main( String JavaDoc[] args )
15     {
16         org.omg.CORBA.ORB JavaDoc orb = org.omg.CORBA.ORB.init(args, null);
17         try
18         {
19             org.omg.PortableServer.POA JavaDoc poa =
20                 org.omg.PortableServer.POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
21
22         poa.the_POAManager().activate();
23             
24             NamingContextExt nc =
25                 NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));
26             NameComponent [] name = new NameComponent[1];
27
28             TransactionService.start( poa, 100 );
29             name[0] =
30                 new NameComponent( "TransactionService",
31                                    "service");
32             nc.bind(name, TransactionService.get_reference());
33
34             LockSetFactoryImpl lsf = new LockSetFactoryImpl( poa );
35             name[0] =
36                 new NameComponent( "ConcurrencyControlService",
37                                    "service");
38
39             nc.bind(name, poa.servant_to_reference( lsf ));
40
41             org.omg.CORBA.Object JavaDoc o =
42                 poa.servant_to_reference( new BankImpl(orb,poa));
43             name[0] = new NameComponent( "DigiBank", "server");
44             nc.bind(name, o);
45
46             orb.run();
47
48         }
49         catch ( Exception JavaDoc e )
50         {
51             e.printStackTrace();
52         }
53     }
54
55
56 }
57
58
59
60
Popular Tags