use of port.sessionserver.SessionObserver in project GIPC by pdewan.
the class AnOldSessionClientLauncher method launch.
public static void launch(String myHost, String myID, String myName) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(myID, myName);
Adder adder = new AnAdder();
serverInputPort.register(Adder.class, adder);
serverInputPort.connect();
// SessionObserver observer = new APrintingSessionObserver();
SessionObserver observer = new AJoinerConnectingSessionObserver(myName);
ServerPortDescription sessionClientDescription = new AServerPortDescription(myHost, myID, myName);
DuplexRPCClientInputPort clientInputPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort("localhost", "" + SESSION_SERVER_PORT, SESSION_SERVER_NAME, myName);
clientInputPort.connect();
try {
SessionServer sessionServerProxy = (SessionServer) DirectedRPCProxyGenerator.generateRPCProxy(clientInputPort, null, SessionServer.class, null);
Object retVal = sessionServerProxy.join("Test Session", sessionClientDescription, observer);
System.out.println(retVal);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations