* Process the object extracted from the received message.
* Pass to this method messageInfo created by logDebugOnReceiveMessage method.
* This method is used by local (listening) connection only.
*/
protected void processReceivedObject(Object object, String messageId) {
Command remoteCommand = null;
if (object instanceof Command) {
remoteCommand = (Command)object;
try {
// prevent the processing of messages sent with the same serviceId
if (shouldCheckServiceId()) {
if (remoteCommand.getServiceId().getId().equals(this.serviceId.getId())) {
return;
}
}
if (remoteCommand.getServiceId().getChannel().equals(this.serviceId.getChannel())) {
if(rcm.shouldLogDebugMessage()) {
Object[] args = { toString(), messageId, remoteCommand.getServiceId().toString(), Helper.getShortClassName(remoteCommand) };
rcm.logDebugWithoutLevelCheck("broadcast_processing_remote_command", args);
}
rcm.processCommandFromRemoteConnection(remoteCommand);
} else {
if(rcm.shouldLogWarningMessage()) {
Object[] args = { toString(), messageId, remoteCommand.getServiceId().toString(), Helper.getShortClassName(remoteCommand)};
rcm.logWarningWithoutLevelCheck("broadcast_ignore_remote_command_from_different_channel", args);
}
}
} catch (RuntimeException e) {
try {
rcm.handleException(RemoteCommandManagerException.errorProcessingRemoteCommand(toString(), messageId, remoteCommand.getServiceId().toString(), Helper.getShortClassName(remoteCommand), e));
} catch (RuntimeException ex) {
// User had a chance to handle the exception.
// The method is called by a listener thread - no one could catch this exception.
}
}