Search in sources :

Example 1 with MessageWithSource

use of sessionport.datacomm.duplex.object.relayed.MessageWithSource in project GIPC by pdewan.

the class AGenericRelayingCollaborativeFrostyModel method messageReceived.

public void messageReceived(String aSourceName, Object aMessage) {
    Tracer.info(this, "message Received:" + aMessage);
    // System.out.println("Message:" + aMessage);
    String oldOutput = output;
    MessageWithSource messageWithSource = (MessageWithSource) aMessage;
    output = (String) messageWithSource.getMessage();
    propertyChangeSupport.firePropertyChange(new PropertyChangeEvent(this, "output", oldOutput, output));
}
Also used : PropertyChangeEvent(java.beans.PropertyChangeEvent) MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource) AMessageWithSource(sessionport.datacomm.duplex.object.relayed.AMessageWithSource)

Example 2 with MessageWithSource

use of sessionport.datacomm.duplex.object.relayed.MessageWithSource in project GIPC by pdewan.

the class ALatecomerMVCServerConnectionListener method processMessages.

// protected void createUI(InputPort anInputPort) {
// DuplexFrostyModel clientModel = getFrostyModel();
// (new ADuplexFrostyAWTGUI()).interact(clientModel);
// (new ADuplexFrostyVerticalGUI()).interact(clientModel);
// FrostyConsoleInteractor frostyInteractor =  new ADuplexFrostyConsoleUI();
// frostyInteractor.interact(clientModel);
// processMessages(messageList); // at this point all listeners have been added
// frostyInteractor.processConsoleInput(); // infinite loop so cannot process mesages after this
// }
protected void processMessages(List<MessageWithSource> messages) {
    relayerPort.addReceiveListener(model);
    relayerPort.removeReceiveListener(sessionJoiner);
    Tracer.info(this, "Process messages");
    for (MessageWithSource message : messages) {
        // System.out.println("processing messages");
        Tracer.info(this, "Process message:" + message);
        relayerPort.notifyPortReceive(((DuplexRPCClientInputPort) inputPort).getLogicalRemoteEndPoint(), message);
    }
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource)

Example 3 with MessageWithSource

use of sessionport.datacomm.duplex.object.relayed.MessageWithSource in project GIPC by pdewan.

the class ASingleResponseLatecomerRelayingGroupConnectionsManager method replayModeEnded.

// // incase some action has to be taken as in subclass
// protected synchronized void replayModeStarted() {
// currentMessagesReceivedInReplayMode =
// }
// incase some action has to be taken as in subclass
protected synchronized void replayModeEnded() {
    super.replayModeEnded();
    for (MessageWithSource message : messagesReceivedInReplayMode) {
        Tracer.info(this, "Playing buffered  message " + message + " after replay mode finish");
        super.messageReceived(message.getSource(), message.getMessage());
    }
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource)

Example 4 with MessageWithSource

use of sessionport.datacomm.duplex.object.relayed.MessageWithSource in project GIPC by pdewan.

the class AnEchoingMessageWithSourceReceiveListener method messageReceived.

@Override
public void messageReceived(String aSourceName, Object aMessage) {
    MessageWithSource aMessageWithSource = (MessageWithSource) aMessage;
    System.out.println(aMessageWithSource.getSource() + "-->" + aSourceName + "-->" + aMessageWithSource.getMessage());
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource)

Example 5 with MessageWithSource

use of sessionport.datacomm.duplex.object.relayed.MessageWithSource in project GIPC by pdewan.

the class ASingleResponseLatecomerRelayingGroupConnectionsManager method messageReceived.

// must make sure that this is mutually exlusive with late comer messages
// this synchronized may cause deadlock
// the control message a client sends can be receibed before the latecomer messges are received
// as latecomer server notifies observers before returning value
// do not know how to fix this problem if we are using rpc
// this is why we need the server message manager to keeo track of late comer status
// could buffer messages received until latecomer has been updated
// we do have the information
// we do not need to make this methiod synchronized in that case
@Override
public synchronized void messageReceived(String remoteClientName, Object message) {
    if (message instanceof MessageWithSource) {
        // current message
        // do not want to buffer return values as these might be needed to complete
        // current call and get out of replay mode
        MessageWithSource messageWithSource = (MessageWithSource) message;
        if (replayMode) {
            Tracer.info(this, "Buffering message in replay mode:" + message);
            messagesReceivedInReplayMode.add((MessageWithSource) message);
        } else
            super.messageReceived(remoteClientName, message);
    } else {
        // past message
        super.messageReceived(remoteClientName, message);
    }
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource)

Aggregations

MessageWithSource (sessionport.datacomm.duplex.object.relayed.MessageWithSource)9 AMessageWithSource (sessionport.datacomm.duplex.object.relayed.AMessageWithSource)4 PropertyChangeEvent (java.beans.PropertyChangeEvent)2 RPCReturnValue (inputport.rpc.duplex.RPCReturnValue)1 SessionParticipantDescription (port.sessionserver.SessionParticipantDescription)1 LatecomerJoinInfo (port.sessionserver.relay.late.LatecomerJoinInfo)1