Search in sources :

Example 1 with DuplexCounterAndSenderAwareSummer

use of inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer in project GIPC by pdewan.

the class AnOldGroupRPCStaticSessionPortLauncher method registerMethods.

// public static void displayConnections() {
// ConnectionEventListener connectionManager = new AConnectionEventManager();
// DistEventsBus.addConnectionEventListener(connectionManager);
// ObjectEditor.edit(connectionManager);
// }
public static void registerMethods(GroupRPCSessionPort rpcPort) {
    DuplexCounterAndSenderAwareSummer adder = new AGroupCounterAndSenderAwareSumPrinter(rpcPort);
    rpcPort.register(DuplexCounterAndSenderAwareSummer.class, adder);
    registerdEchoer = new ARegisteredEchoer();
    rpcPort.register(AnotherEchoer.class, registerdEchoer);
    counter = new AnAnotherCounter();
    counter = new ACounterWithObjectValue();
    rpcPort.register(CounterWithObjectValue.class, counter);
    rpcPort.register(AnotherCounter.class, counter);
}
Also used : DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) AnAnotherCounter(inputport.rpc.duplex.example.AnAnotherCounter) AGroupCounterAndSenderAwareSumPrinter(inputport.rpc.group.example.AGroupCounterAndSenderAwareSumPrinter) ARegisteredEchoer(inputport.rpc.duplex.example.ARegisteredEchoer) ACounterWithObjectValue(inputport.rpc.group.example.ACounterWithObjectValue)

Example 2 with DuplexCounterAndSenderAwareSummer

use of inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer 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);
}
Also used : DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Example 3 with DuplexCounterAndSenderAwareSummer

use of inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer in project GIPC by pdewan.

the class AGroupRPCStaticSessionPortLauncher method registerRemoteObjects.

@Override
protected void registerRemoteObjects() {
    super.registerRemoteObjects();
    GroupRPCSessionPort aGroupRPCSessionPort = (GroupRPCSessionPort) mainPort;
    DuplexCounterAndSenderAwareSummer adder = new AGroupCounterAndSenderAwareSumPrinter(aGroupRPCSessionPort);
    aGroupRPCSessionPort.register(DuplexCounterAndSenderAwareSummer.class, adder);
    // registerdEchoer = new AnEchoer();
    registerdEchoer = new ARegisteredEchoer();
    // aGroupRPCSessionPort.register(Echoer.class, registerdEchoer);
    aGroupRPCSessionPort.register(ARegisteredEchoer.class, registerdEchoer);
// counter = new ACounter();
// counter = new ACounterWithObjectValue();
// aGroupRPCSessionPort.register(CounterWithObjectValue.class, counter);
// aGroupRPCSessionPort.register(Counter.class, counter);
}
Also used : GroupRPCSessionPort(sessionport.rpc.group.GroupRPCSessionPort) DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) AGroupCounterAndSenderAwareSumPrinter(inputport.rpc.group.example.AGroupCounterAndSenderAwareSumPrinter) ARegisteredEchoer(inputport.rpc.duplex.example.ARegisteredEchoer)

Example 4 with DuplexCounterAndSenderAwareSummer

use of inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer in project GIPC by pdewan.

the class AnOldGroupRPCStaticSessionPortLauncher method launchStaticSessionPartipant.

public static void launchStaticSessionPartipant(ServerPortDescription[] aServerList, String anId, String aName) {
    // Tracer.showInfo(true);
    // ConnectionEventListener connectionManager = new AConnectionEventManager();
    // DistEventsBus.addConnectionEventListener(connectionManager);
    // ObjectEditor.edit(connectionManager);
    System.out.println("Race conditions galore in this example because of calls to getLastSender() by the registered methods");
    PortMisc.displayConnections();
    RelayerClientAndServerSupport.setRelayedCommunicaton(false);
    GroupRPCSessionPort sessionPort = null;
    // fix this later
    // GroupRPCStaticSessionPortSelector.createGroupRPCStaticSessionPort(aServerList, anId, aName, null, null
    // );
    registerMethods(sessionPort);
    // ConnectionListener connectListener = new AGroupCallingConnectListener(sessionPort);
    // sessionPort.addConnectionListener(connectListener);
    // Adder adder = new AnAdder();
    // sessionPort.register(Adder.class, adder);
    // DuplexCounterAndSenderAwareSumComputerAndPrinter adder = new AGroupCounterAndSenderAwareSumPrinter(sessionPort);
    // sessionPort.register(DuplexCounterAndSenderAwareSumComputerAndPrinter.class, adder);
    unregisteredEchoer = new AnUnregisteredEchoer();
    // registerdEchoer = new ARegisteredEchoer();
    // sessionPort.register(Echoer.class, registerdEchoer);
    Scanner in = new Scanner(System.in);
    // Tracer.showInfo(true);
    // waitForUserToOKConnectionThroughConsole(in);
    DuplexCounterAndSenderAwareSummer adderProxy = (DuplexCounterAndSenderAwareSummer) GroupRPCProxyGenerator.generateAllRPCProxy(sessionPort, DuplexCounterAndSenderAwareSummer.class, null);
    // counter = new ACounter();
    // counter = new ACounterWithObjectValue();
    // sessionPort.register(CounterWithObjectValue.class, counter);
    // sessionPort.register(Counter.class, counter);
    // Adder adderProxy = (Adder) GroupRPCProxyGenerator.generateAllRPCProxy(sessionPort,  DuplexCounterAndSenderAwareSumComputerAndPrinter.class, null);
    waitForUserToOKConnectionThroughDialogBox();
    sessionPort.connect();
    while (true) {
        System.out.println("Please enter two messages:");
        String stringMessage1 = in.nextLine();
        String stringMessage2 = in.nextLine();
        counter.increment(1);
        try {
            // synchronous
            Object[] retVal = (Object[]) adderProxy.sum(stringMessage1, stringMessage2);
            for (Object val : retVal) {
                System.out.println("Remote sum:" + val);
            }
            // // sync or async depending on RPC
            adderProxy.printUppercase(stringMessage1);
            // // sync or async depending on RPC, sync will cause deadlock
            // lots of messages being sent. Race conditions determine what last sender is when call others is invoked
            adderProxy.printSumAndCallBackProcedureAndFunction(unregisteredEchoer, stringMessage1, stringMessage2);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
// System.out.println("Press any key to ask for group add");
// message  = in.nextLine();
// Adder adderProxy = (Adder) GroupRPCProxyGenerator.generateAllRPCProxy(sessionPort,  Adder.class, null);
// adderProxy.printSum(5, 6);
}
Also used : Scanner(java.util.Scanner) GroupRPCSessionPort(sessionport.rpc.group.GroupRPCSessionPort) DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) AnUnregisteredEchoer(inputport.rpc.duplex.example.AnUnregisteredEchoer)

Example 5 with DuplexCounterAndSenderAwareSummer

use of inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer in project GIPC by pdewan.

the class ASingleResponseReplicatedGroupSessionPortServerLauncher method registerRemoteObjects.

// protected Counter createAndRegisterCounter(RPCRegistry aClientInputPort) {
// Counter counter = new ACounterWithObjectValue();
// aClientInputPort.register(counter);
// return counter;
// }
@Override
protected void registerRemoteObjects() {
    GroupRPCServerInputPort aGroupServerInputPort = (GroupRPCServerInputPort) mainPort;
    DuplexCounterAndSenderAwareSummer adder = new AGroupCounterAndSenderAwareSumPrinter(aGroupServerInputPort);
    aGroupServerInputPort.register(adder);
}
Also used : DuplexCounterAndSenderAwareSummer(inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer) AGroupCounterAndSenderAwareSumPrinter(inputport.rpc.group.example.AGroupCounterAndSenderAwareSumPrinter) GroupRPCServerInputPort(inputport.rpc.group.GroupRPCServerInputPort)

Aggregations

DuplexCounterAndSenderAwareSummer (inputport.rpc.duplex.example.DuplexCounterAndSenderAwareSummer)6 AGroupCounterAndSenderAwareSumPrinter (inputport.rpc.group.example.AGroupCounterAndSenderAwareSumPrinter)4 GroupRPCServerInputPort (inputport.rpc.group.GroupRPCServerInputPort)3 ARegisteredEchoer (inputport.rpc.duplex.example.ARegisteredEchoer)2 GroupRPCSessionPort (sessionport.rpc.group.GroupRPCSessionPort)2 AnAnotherCounter (inputport.rpc.duplex.example.AnAnotherCounter)1 AnUnregisteredEchoer (inputport.rpc.duplex.example.AnUnregisteredEchoer)1 ACounterWithObjectValue (inputport.rpc.group.example.ACounterWithObjectValue)1 Scanner (java.util.Scanner)1