Search in sources :

Example 6 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 7 with MessageWithSource

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

the class ALatecomerRelayingGroupConnectionsManager method doJoinSessionServer.

// // no reason for this to be a separate method as far as I can tell
// protected void doJoinSessionServer() {
// Tracer.info (this, "About to make late join session sync call to  session server :" + sessionName);
// LatecomerJoinInfo joinRetVal = logicalLatecomerSessionsServerProxy.lateJoin(sessionName, sessionClientDescription, this);
// //		LatecomerSessionsServer physicalSessionsServerProxy = (LatecomerSessionsServer) physicalServerNameToProxy.get(serverName);
// //		LatecomerJoinInfo joinRetVal = physicalSessionsServerProxy.lateJoin(sessionName, sessionClientDescription, this);
// Tracer.info (this, "Received back late join info :" + joinRetVal);
// List<ServerPortDescription> currentMembers = joinRetVal.getUsers();
// processCurrentMembers(currentMembers);
// List<MessageWithSource> pastMessages = joinRetVal.getMessages();
// processPastMessages(pastMessages);
// }
// no reason for this to be a separate method as far as I can tell
// artiact of the fact that at one time remote calls were not executed
// in a separate thread
// actually received calls are in a separate thread
// this is an initiated call, so needs gto be in separate thread
protected void doJoinSessionServer() {
    List<SessionParticipantDescription> currentMembers = null;
    List<MessageWithSource> pastMessages = null;
    Tracer.info(this, "About to make late join session sync call to  session server :" + sessionName);
    LatecomerJoinInfo lateJoinInfo = null;
    switch(joinChoice) {
        case SYMMETRIC_JOIN:
        case MEMBER:
            lateJoinInfo = logicalLatecomerSessionsServerProxy.lateJoin(sessionName, sessionClientDescription, this);
            Tracer.info(this, "Received back late join info :" + lateJoinInfo);
            // currentMembers = AJoinInfo.getMembersClientsAndServers(lateJoinInfo);
            // this was commented out before
            pastMessages = lateJoinInfo.getMessages();
            break;
        case SERVER_ONLY:
            lateJoinInfo = logicalLatecomerSessionsServerProxy.lateJoinAsServer(sessionName, sessionClientDescription, this);
            // currentMembers = AJoinInfo.getMembersAndClients(lateJoinInfo); // can add everyone if needed, connect type allows that
            // commentd out before
            pastMessages = lateJoinInfo.getClientMessages();
            break;
        case CLIENT_ONLY:
            lateJoinInfo = logicalLatecomerSessionsServerProxy.lateJoinAsClient(sessionName, sessionClientDescription, this);
            // currentMembers =AJoinInfo.getMembersAndServers(lateJoinInfo); // can add everyone if necessary
            // c commented out befoere
            pastMessages = lateJoinInfo.getServerMessages();
            // Tracer.setKeywordDisplayStatus(Tracer.ALL_KEYWORDS, true);
            break;
    }
    // this is members and servers in old distTeaching. This is what causes the connected call to have to
    // check if the joined process is  a server
    currentMembers = AJoinInfo.getMembersClientsAndServers(lateJoinInfo);
    // commenting this out as we want specialized semantics
    // pastMessages = lateJoinInfo.getMessages();
    servers = lateJoinInfo.getServers();
    clients = lateJoinInfo.getClients();
    members = lateJoinInfo.getMembers();
    // this is to be consistent with P2P, but perhaps this connection should not be generated
    // as it causes issues down the line with single response
    // this connect will trigger addition of server
    duplexObjectSessionPort.notifyConnect(duplexObjectSessionPort.getLocalName(), ASessionBasedFP2PBufferConnectionsManager.toMyConnectionType(joinChoice));
    processCurrentMembers(currentMembers);
    Tracer.info(this, "Past messages:" + pastMessages);
    // bring this here so that control message (because of upstream connect) can be sent after messages processed
    processPastMessages(pastMessages);
    // this happens after replay, so messages may not be sent
    if (duplexObjectSessionPort.getLogicalRemoteEndPoint() != null && currentMembers.size() > 0) {
        // a replicated port
        duplexObjectSessionPort.notifyConnect(duplexObjectSessionPort.getLogicalRemoteEndPoint(), ConnectionType.TO_LOGICAL_SERVER);
        initialJoin = false;
        logicalConnectionNotificationSent = true;
    }
// processPastMessages(pastMessages);
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource) AMessageWithSource(sessionport.datacomm.duplex.object.relayed.AMessageWithSource) SessionParticipantDescription(port.sessionserver.SessionParticipantDescription) LatecomerJoinInfo(port.sessionserver.relay.late.LatecomerJoinInfo)

Example 8 with MessageWithSource

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

the class ALatecomerRelayingGroupConnectionsManager method processPastMessages.

// public void run () {
// doJoinSessionServer();
// }
// need to worry about return values to rpc calls
// they should not be sent back
// must put the system in a special mode where these values
// are not sent
// need to synchronize this so that new messages and processed later
// bu then return values will not be trapped as they are generated
// maybe we count the number and then
// do not send back those number of them
// need to synchronize the receive call also
// could also not send calls with return values
// the only issue was that the server and count wsa not updating atomically
// leading to server not thinking it was a latecomer and sending spurious messages
protected synchronized void processPastMessages(List<MessageWithSource> aMessageList) {
    if (aMessageList == null || aMessageList.size() == 0) {
        // test size to prevent spurious events
        replayModeEnded();
        return;
    }
    // System.out.println("Procsss past messages");
    ReplayStartInfo.newCase(this, aMessageList);
    for (int i = 0; i < aMessageList.size(); i++) {
        MessageWithSource nextMessage = aMessageList.get(i);
        if ((joinChoice != ParticipantChoice.SERVER_ONLY) && (nextMessage.getMessage() instanceof RPCReturnValue)) {
            // to a call made by a replicated peer
            continue;
        }
        // working and then process a control message that executes in this thread.
        if (// make sure the requests of them do not block as blokcing indicates end of replay
        nextMessage.getMessage() instanceof RPCReturnValue)
            processPastMessage(nextMessage.getSource(), nextMessage.getMessage());
    // messageReceived(nextMessage.getSource(), nextMessage.getMessage());
    }
    for (int i = 0; i < aMessageList.size(); i++) {
        MessageWithSource nextMessage = aMessageList.get(i);
        // working and then process a control message that executes in this thread.
        if (// now play other messages
        !(nextMessage.getMessage() instanceof RPCReturnValue))
            processPastMessage(nextMessage.getSource(), nextMessage.getMessage());
    // messageReceived(nextMessage.getSource(), nextMessage.getMessage());
    }
    AsyncReplayEndInfo.newCase(this, aMessageList);
}
Also used : MessageWithSource(sessionport.datacomm.duplex.object.relayed.MessageWithSource) AMessageWithSource(sessionport.datacomm.duplex.object.relayed.AMessageWithSource) RPCReturnValue(inputport.rpc.duplex.RPCReturnValue)

Example 9 with MessageWithSource

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

the class ALatecomerMVCServerAndLauncherConnectionListener method processMessages.

protected void processMessages(List<MessageWithSource> messages) {
    Tracer.info(this, "Process messages");
    for (MessageWithSource message : messages) {
        Tracer.info(this, "Process message:" + message);
        relayerPort.notifyPortReceive(mvcClientPort.getLogicalRemoteEndPoint(), 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