Basic HTML version of Foils prepared 4 Feb 98

Foil 54 Example Server II - HelloServer

From Overview of JDBC and its use with CORBA or Java RMI CPS616 Technologies of Information Age -- Spring 1998. by Nancy McCracken(Sangetta Aggarwal, Udayan Parvate, Tom Pulikal)


1 public class HelloServer {
2 public static void main(String args[]) {
3 try{
4 // create and initialize the ORB
5 ORB orb = ORB.init(args, null);
6 // create servant and register it with the ORB
7 HelloServant HelloRef = new HelloServant(); orb.connect(HelloRef);
8 // get the root naming context
9 org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
10 NamingContext ncRef = NamingContextHelper.narrow(objRef);
11 // bind the Object Reference in Naming
12 NameComponent nc = new NameComponent("Hello", "");
13 NameComponent path[] = {nc}; ncRef.rebind(path, HelloRef);
14 // wait for invocations from clients
15 java.lang.Object sync = new java.lang.Object();
16 synchronized (sync) {
17 sync.wait();
18 }
19 } catch (Exception e) {
20 System.err.println("ERROR: " + e);
21 e.printStackTrace(System.out);
22 }}}

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998