use of inputport.rpc.duplex.RPCReturnValue 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);
}
Aggregations