Search in sources :

Example 1 with AnObjectGroupSendingReceiveListener

use of port.delay.example.AnObjectGroupSendingReceiveListener in project GIPC by pdewan.

the class AFaultTolerantSessionPortLauncher method launchSessionPartipant.

public static void launchSessionPartipant(String anId, String aName, boolean addConnectListener, boolean addReplyingReceiveListener, boolean greetOnReadingInput) {
    Tracer.showInfo(true);
    RelayerClientAndServerSupport.setRelayedCommunicaton(false);
    DelayUtlity.setDelayClientBufferSends(true);
    // GlobalState.setCausalBroadcast(true);
    // GroupSessionPort<Object> groupSessionPort = ObjectGroupStaticSessionPortSelector.createObjectGroupStaticSessionPort(serversDescription, null, aName);
    // GroupMultiServerClientPort<Object> groupMultiServerPort = ObjectGroupMultiServerPortSelector.createGroupMultiServerClientPort(serversDescription, null, aName);
    // DuplexClientInputPort<Object> sessionsServerObjectPort = new AReplicatedServerDuplexClientPort<Object>(groupMultiServerPort, SESSION_SERVER_NAME );
    // DuplexRPCClientInputPort sessionsServerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(sessionsServerObjectPort);
    DuplexRPCClientInputPort sessionsServerClientPort = ReplicatedServerDuplexRPCClientPortSelector.createDuplexRPCPort(serversDescription, SESSION_SERVER_NAME, aName, ParticipantChoice.SYMMETRIC_JOIN);
    DuplexSingleResponseUtlity.supportSingleResponse(sessionsServerClientPort);
    // GlobalState.setDelayAndCausal(true);
    // DuplexRPCClientInputPort sessionManagerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
    // "localhost", "" +  SESSION_SERVER_PORT, SESSION_SERVER_NAME, aName);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionsServerClientPort, "Test Session", anId, aName, ParticipantChoice.MEMBER);
    ACausalGroupSessionPortLauncherSupport.doCausalBroadcast(sessionPort);
    // PrintingReplyingReceiveListener printingReplyingReceiveListener = new PrintingReplyingReceiveListener(sessionPort);
    if (addConnectListener) {
        ConnectionListener connectListener = new AnObjectGroupSendingConnectListener(sessionPort);
        // sessionPort.addConnectListener(printingReplyingReceiveListener);
        sessionPort.addConnectionListener(connectListener);
    }
    if (addReplyingReceiveListener)
        sessionPort.addReceiveListener(new AnObjectGroupSendingReceiveListener(sessionPort));
    else
        sessionPort.addReceiveListener(new AnEchoingObjectReceiveListener());
    // serverInputPort.addDisconnectListener(echoingReceiveListener);
    // sessionPort.addReceiveListener(printingReplyingReceiveListener);
    sessionPort.connect();
    System.out.println("-----------------------Connected to Session Port---------------------------------------");
    Scanner in = new Scanner(System.in);
    if (greetOnReadingInput) {
        String message = in.nextLine();
        sessionPort.sendAll(aName + " says hi to all");
    }
    while (true) {
        String message = in.nextLine();
        sessionPort.sendAll(aName + message);
    }
}
Also used : Scanner(java.util.Scanner) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort) AnEchoingObjectReceiveListener(port.delay.example.AnEchoingObjectReceiveListener) ConnectionListener(inputport.ConnectionListener) AnObjectGroupSendingConnectListener(sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener) AnObjectGroupSendingReceiveListener(port.delay.example.AnObjectGroupSendingReceiveListener)

Example 2 with AnObjectGroupSendingReceiveListener

use of port.delay.example.AnObjectGroupSendingReceiveListener in project GIPC by pdewan.

the class ALatecomerAssymetricObjectGroupSessionPortLauncher method launchSessionPartipant.

public static void launchSessionPartipant(String anId, String aName, boolean addConnectListener, boolean addReplyingReceiveListener, boolean greetOnReadingInput) {
    PortMisc.displayConnections();
    // Tracer.showInfo(true);
    // Tracer.setKeyWordStatus(Tracer.ALL_KEYWORDS, false);
    // Tracer.setKeyWordStatus("socketip", true);
    // Tracer.setKeyWordStatus("socketdip", true);
    // Tracer.setKeyWordStatus("sesrelaylategrpobj", true);
    // Tracer.setKeyWordStatus("repsrvdupsingleresp", true);
    // Tracer.setKeyWordStatus("repsrvgrpsingleresp", true);
    // Tracer.setKeyWordStatus("sesrelay", true);
    ALatecomerRelayerAndSessionServerLauncherSupport.setLatecomerRelayedCommunicaton(true);
    // GlobalState.setAnyCast(true);
    DelayUtlity.setDelayClientBufferSends(true);
    // DuplexRPCClientInputPort sessionManagerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
    // "localhost", "" +
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_PORT,
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_NAME,
    // aName);
    DuplexRPCClientInputPort sessionManagerClientPort = ReplicatedServerDuplexRPCClientPortSelector.createDuplexRPCPort(serversDescription, SESSION_SERVER_NAME, aName, ParticipantChoice.SYMMETRIC_JOIN);
    DuplexSingleResponseUtlity.supportSingleResponse(sessionManagerClientPort);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionManagerClientPort, SESSION_NAME, anId, aName, ParticipantChoice.MEMBER);
    // GlobalState.doCausalBroadcast(sessionPort);
    if (addConnectListener) {
        ConnectionListener connectListener = new AnObjectGroupSendingConnectListener(sessionPort);
        sessionPort.addConnectionListener(connectListener);
    }
    if (addReplyingReceiveListener)
        sessionPort.addReceiveListener(new AnObjectGroupSendingReceiveListener(sessionPort));
    else
        sessionPort.addReceiveListener(new AnEchoingObjectReceiveListener());
    sessionPort.connect();
    System.out.println("-----------------------Connected to Session Port---------------------------------------");
    if (greetOnReadingInput) {
        Scanner in = new Scanner(System.in);
        // sessionPort.sendAll(aName + " says hi to all");
        while (true) {
            System.out.println("Please enter  next input");
            // in = new Scanner(System.in);
            String message = in.nextLine();
            sessionPort.sendAll(message);
        }
    }
}
Also used : Scanner(java.util.Scanner) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort) AnEchoingObjectReceiveListener(port.delay.example.AnEchoingObjectReceiveListener) ConnectionListener(inputport.ConnectionListener) AnObjectGroupSendingConnectListener(sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener) AnObjectGroupSendingReceiveListener(port.delay.example.AnObjectGroupSendingReceiveListener)

Example 3 with AnObjectGroupSendingReceiveListener

use of port.delay.example.AnObjectGroupSendingReceiveListener in project GIPC by pdewan.

the class AnOldLatecomerObjectGroupSessionPortLauncher method launchSessionPartipant.

public static void launchSessionPartipant(String anId, String aName, boolean addConnectListener, boolean addReplyingReceiveListener, boolean greetOnReadingInput) {
    PortMisc.displayConnections();
    // Tracer.showInfo(true);
    // Tracer.setKeyWordStatus(Tracer.ALL_KEYWORDS, false);
    // Tracer.setKeyWordStatus("socketip", true);
    // Tracer.setKeyWordStatus("socketdip", true);
    // Tracer.setKeyWordStatus("sesrelaylategrpobj", true);
    // Tracer.setKeyWordStatus("repsrvdupsingleresp", true);
    // Tracer.setKeyWordStatus("repsrvgrpsingleresp", true);
    // Tracer.setKeyWordStatus("sesrelay", true);
    ALatecomerRelayerAndSessionServerLauncherSupport.setLatecomerRelayedCommunicaton(true);
    // GlobalState.setAnyCast(true);
    DelayUtlity.setDelayClientBufferSends(true);
    // DuplexRPCClientInputPort sessionManagerClientPort = DuplexRPCInputPortSelector.createDuplexRPCClientInputPort(
    // "localhost", "" +
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_PORT,
    // ALatecomerSessionsServerLauncher.SESSION_SERVER_NAME,
    // aName);
    DuplexRPCClientInputPort sessionManagerClientPort = ReplicatedServerDuplexRPCClientPortSelector.createDuplexRPCPort(serversDescription, SESSION_SERVER_NAME, aName, ParticipantChoice.MEMBER);
    DuplexSingleResponseUtlity.supportSingleResponse(sessionManagerClientPort);
    GroupSessionPort<Object> sessionPort = ObjectGroupSessionPortSelector.createObjectGroupSessionPort(sessionManagerClientPort, SESSION_NAME, anId, aName, ParticipantChoice.MEMBER);
    // GlobalState.doCausalBroadcast(sessionPort);
    if (addConnectListener) {
        ConnectionListener connectListener = new AnObjectGroupSendingConnectListener(sessionPort);
        sessionPort.addConnectionListener(connectListener);
    }
    if (addReplyingReceiveListener)
        sessionPort.addReceiveListener(new AnObjectGroupSendingReceiveListener(sessionPort));
    else
        sessionPort.addReceiveListener(new AnEchoingObjectReceiveListener());
    sessionPort.connect();
    System.out.println("-----------------------Connected to Session Port---------------------------------------");
    if (greetOnReadingInput) {
        Scanner in = new Scanner(System.in);
        // sessionPort.sendAll(aName + " says hi to all");
        while (true) {
            System.out.println("Please enter  next input");
            // in = new Scanner(System.in);
            String message = in.nextLine();
            sessionPort.sendAll(message);
        }
    }
}
Also used : Scanner(java.util.Scanner) DuplexRPCClientInputPort(inputport.rpc.duplex.DuplexRPCClientInputPort) AnEchoingObjectReceiveListener(port.delay.example.AnEchoingObjectReceiveListener) ConnectionListener(inputport.ConnectionListener) AnObjectGroupSendingConnectListener(sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener) AnObjectGroupSendingReceiveListener(port.delay.example.AnObjectGroupSendingReceiveListener)

Aggregations

ConnectionListener (inputport.ConnectionListener)3 DuplexRPCClientInputPort (inputport.rpc.duplex.DuplexRPCClientInputPort)3 Scanner (java.util.Scanner)3 AnEchoingObjectReceiveListener (port.delay.example.AnEchoingObjectReceiveListener)3 AnObjectGroupSendingReceiveListener (port.delay.example.AnObjectGroupSendingReceiveListener)3 AnObjectGroupSendingConnectListener (sessionport.datacomm.group.object.example.AnObjectGroupSendingConnectListener)3