Basic HTML version of Foils prepared May 19 1999

Foil 74 Example Server II - HelloServer

From CORBA Common Object Request Broker Architecture Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. by Geoffrey Fox, Wojtek Furmanski, Nancy McCracken, Chao-Wei Ou, Shrideep Pallickara


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 =
10 orb.resolve_initial_references("NameService");
11 NamingContext ncRef = NamingContextHelper.narrow(objRef);
12 // bind the Object Reference in Naming
13 NameComponent nc = new NameComponent("Hello", "");
14 NameComponent path[] = {nc}; ncRef.rebind(path, HelloRef);
15 // wait for invocations from clients
16 java.lang.Object sync = new java.lang.Object();
17 synchronized (sync) {
18 sync.wait();
19 }
20 . . . // catch exceptions
21 }

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 Mon Jul 5 1999