use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.
the class ALatecomerRelayerAndSessionServerFactory method createLatecomerSessionsServerAndRelayer.
// @Override
// public GroupRPCServerInputPort createLatecomerSessionsServerAndRelayer(
// String aSessionServerId, String aSessionsServerName,
// String aLogicalServerName) {
//
//
//
//
// GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(
// aSessionServerId, aSessionsServerName);
// // GroupSingleResponseSetter.supportSingleResponse(serverInputPort);
// LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionsServer(serverInputPort);
// serverInputPort.register(sessionsServer);
// // serverInputPort.register(LatecomerSessionsServer.class, sessionsServer);
// serverInputPort.register(aSessionsServerName, sessionsServer);
// Tracer.info(this, "Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId );
// GroupRPCServerInputPort relayPort = serverInputPort; // this causes confusion as multiple client input ports may be opened to same server port
// // those that will use the description should get a separate port, those who do not will simply connect to the same port
// LatecomerRelayer relayer = LatecomerRelayerObjectSelector.createRelayer(relayPort, sessionsServer);
// relayPort.register(relayer);
//
// // relayPort.register(LatecomerRelayer.class, relayer);
// Tracer.info(this, "Created and registered relayer object connected to server port " + serverInputPort);
// // relayPort.register(aSessionsServerName, relayer);
// ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, aSessionsServerName);
// Tracer.info(this, "Registering relayer description " + relayerPortDescription + " with session server");
// sessionsServer.setRelayerDescripton(relayerPortDescription);
//
// // serverInputPort.connect();
// return serverInputPort;
// }
@Override
public GroupRPCServerInputPort createLatecomerSessionsServerAndRelayer(String aSessionServerId, String aSessionsServerName, String aLogicalServerName) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(aSessionServerId, // group so that it can be integrated with the relayer to avoid extra port creation and message cost
aSessionsServerName);
// GroupSingleResponseSetter.supportSingleResponse(serverInputPort);
LocalLatecomerSessionsServer sessionsServer = new ALatecomerSessionServer(serverInputPort);
serverInputPort.register(sessionsServer);
// serverInputPort.register(LatecomerSessionsServer.class, sessionsServer);
serverInputPort.register(aSessionsServerName, sessionsServer);
serverInputPort.register(aLogicalServerName, sessionsServer);
Tracer.info(this, "Created and registered Latecomer session server object connected to server port " + serverInputPort + " for " + aSessionServerId);
// this causes confusion as multiple client input ports may be opened to same server port
// however, registering under a different port means an additional port must be chosen and used
// best to let the client be aware that the session server is also the relayer
// by sending null fields in the server port description
GroupRPCServerInputPort relayPort = serverInputPort;
// ServerPortDescription relayerPortDescription = new AServerPortDescription("localhost", "" + aSessionServerId, aSessionsServerName);
// ServerPortDescription relayerPortDescription = new AServerPortDescription(null, null, null);
// for some reason I put null here instead of a server port description
ServerPortDescription relayerPortDescription = null;
// GroupRPCServerInputPort relayPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(
// relayerPortDescription.getID(), relayerPortDescription.getName());
// those that will use the description should get a separate port, those who do not will simply connect to the same port
LatecomerRelayer relayer = LatecomerRelayerObjectSelector.createRelayer(relayPort, sessionsServer);
relayPort.register(relayer);
// relayPort.register(LatecomerRelayer.class, relayer);
Tracer.info(this, "Created and registered relayer object connected to server port " + serverInputPort);
// relayPort.register(aSessionsServerName, relayer);
// regster after creating the relayer
sessionsServer.setRelayerDescripton(relayerPortDescription);
Tracer.info(this, "Registered relayer description " + relayerPortDescription + " with session server");
// serverInputPort.connect();
return serverInputPort;
}
use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.
the class AGroupRPCServerLauncher method launchGroupServer.
public static void launchGroupServer(String anId, String aName) {
Tracer.showInfo(true);
RelayerClientAndServerSupport.setRelayedCommunicaton(false);
GroupRPCServerInputPort serverPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(anId, aName);
// ConnectListener connectListener = new AGroupCallingConnectListener(serverPort);
// serverPort.addConnectListener(connectListener);
Adder adder = new AnAdder();
serverPort.register(Adder.class, adder);
serverPort.connect();
}
use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.
the class AGroupRPCServerInputPortLauncher method registerRemoteObjects.
@Override
protected void registerRemoteObjects() {
GroupRPCServerInputPort aGroupServerInputPort = (GroupRPCServerInputPort) mainPort;
DuplexCounterAndSenderAwareSummer adder = new AGroupCounterAndSenderAwareSumPrinter(aGroupServerInputPort);
aGroupServerInputPort.register(adder);
}
use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.
the class ARelayerPortFactory method createRelayerPort.
// public GroupRPCServerInputPort createRelayerPort(
// String aRelayerServerId, String aRelayerServerName,
// String sessionsServerHost, String sessionsServerId, String sessionsServerName, String aSessionName) {
// DuplexRPCClientInputPort aSessionServerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
// sessionsServerHost, sessionsServerId,
// sessionsServerName, aRelayerServerName);
// return createRelayerPort(aRelayerServerId, aRelayerServerName, aSessionServerClientPort, aSessionName);
// // sessionsServer.setRelayerDescripton(serverPortDescription);
//
//
// }
//
// public GroupRPCServerInputPort createRelayerPort(
// String aRelayerServerId, String aRelayerServerName,
// DuplexRPCClientInputPort aSessionServerClientPort, String aSessionName) {
//
// GroupRPCServerInputPort retVal = createRelayerPort (aRelayerServerId, aRelayerServerName);
// ServerPortDescription serverPortDescription = new AServerPortDescription("localhost", aRelayerServerId, aRelayerServerName);
// RelayerSupportingSessionServer sessionsServer = (RelayerSupportingSessionServer) DirectedRPCProxyGenerator.generateRPCProxy(aSessionServerClientPort, null, RelayerSupportingSessionServer.class, aSessionServerClientPort.getLogicalRemoteEndPoint());
// aSessionServerClientPort.addConnectionListener(new ASessionServerToRelayerConnectionListener(sessionsServer, serverPortDescription, aSessionName));
// aSessionServerClientPort.connect();
// return retVal;
//
//
// }
public GroupRPCServerInputPort createRelayerPort(String relayerId, String relayerName) {
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort(relayerId, relayerName);
Relayer relayer = RelayerObjectSelector.createRelayer(serverInputPort);
// serverInputPort.register(ARelayer.class, relayer);
serverInputPort.register(relayer);
serverInputPort.register(relayerName, relayer);
return serverInputPort;
}
use of inputport.rpc.group.GroupRPCServerInputPort in project GIPC by pdewan.
the class AGroupRPCServerInputPortLauncher method main.
public static void main(String[] args) {
Tracer.showInfo(true);
GroupRPCServerInputPort serverInputPort = GroupRPCInputPortSelector.createGroupRPCServerInputPort("9090", "test server");
serverInputPort.connect();
PrintingReplyingObjectReceiver messageReceiver = new PrintingReplyingObjectReceiver(serverInputPort);
serverInputPort.addConnectionListener(messageReceiver);
Adder adder = new AnAdder();
serverInputPort.register(Adder.class, adder);
AGroupAdder groupAdder = new AGroupAdder(serverInputPort);
serverInputPort.register(GroupAdder.class, groupAdder);
serverInputPort.addSendListener(messageReceiver);
}
Aggregations