public void pipeMsgEvent(PipeMsgEvent event, JxtaBiDiPipe thePipe) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("PipeWrapper>>pipeMsgEvent");
}
Message msg = null;
try {
// grab the message from the event
msg = event.getMessage();
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("PipeWrapper>>pipeMsgEvent:msg=" + msg);
}
if (msg == null) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("Received an empty message, returning");
}
return;
}
// get the message element named SenderMessage
MessageElement instanceNameMsgElement =
msg.getMessageElement(ReplicationState.InstanceNameMessage, ReplicationState.InstanceNameMessage);
//ignore broadcasts from yourself
String returnInstance = null;
if (instanceNameMsgElement != null) {
returnInstance = instanceNameMsgElement.toString();
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("InputPipeWrapper:incoming propagated msg from: " + returnInstance);
}
if (ReplicationUtil.getInstanceName().equalsIgnoreCase(returnInstance)) {
return;
}
}
MessageElement readyMsgElement = msg.getMessageElement(ReplicationState.ReadyMessage, ReplicationState.ReadyMessage);
if (readyMsgElement != null) {
try {
Thread.currentThread().sleep(2000L);
} catch (InterruptedException ex) {
}
if (_pipelogger.isLoggable(Level.FINE)) {
_pipelogger.fine("readyMsgElement=" + readyMsgElement.toString() + " from: " + returnInstance);
}
JoinNotificationEventHandler.checkAndDoJoinFor(returnInstance);
//TODO Can we return??
}
MessageElement bulkMsgElement = msg.getMessageElement(ReplicationState.BULK_MESSAGE_MODE, ReplicationState.BULK_MESSAGE_MODE);
if (bulkMsgElement != null) {
processBulkMessage(msg, bulkMsgElement, thePipe);
return;
}
MessageElement idMsgElement = msg.getMessageElement(ReplicationState.MESSAGE_ID, ReplicationState.MESSAGE_ID);
if (idMsgElement != null) {
if (_logger.isLoggable(Level.FINE)) {
_logger.fine("idMsgElement=" + idMsgElement.toString());
}
}
MessageElement commandMsgElement =
msg.getMessageElement(ReplicationState.MESSAGE_COMMAND, ReplicationState.MESSAGE_COMMAND);
if (commandMsgElement != null) {
String theCommand = commandMsgElement.toString();
if (isBroadcastMethod(theCommand)) {
//processQueryMessage(msg, idMsgElement, returnInstance);
ReplicationMessageRouter receiver = getRouter();