*
* @param command An object representing a EclipseLink command
*/
public void propagateCommand(Object command) {
Command newCommand;
CommandPropagator propagator;
this.commandProcessor.startOperationProfile(SessionProfiler.CacheCoordination);
try {
if (this.commandConverter != null) {
// Use the converter if we have one
Object[] args = { command };
logDebug("converting_to_toplink_command", args);
this.commandProcessor.incrementProfile(SessionProfiler.RcmSent);
newCommand = this.commandConverter.convertToEclipseLinkCommand(command);
} else if (command instanceof Command) {
// If converter is not set then maybe it just doesn't need converting
newCommand = (Command)command;
} else {
// We can't convert the thing - we may as well chuck it!
Object[] args = { command };
logWarning("missing_converter", args);
return;
}
// Set our service id on the command to indicate that it came from us
newCommand.setServiceId(getServiceId());
// PERF: Support plugable serialization.
Serializer serializer = getSerializer();
byte[] commandBytes = null;
if (serializer != null) {
this.commandProcessor.startOperationProfile(SessionProfiler.CacheCoordinationSerialize);
try {
commandBytes = (byte[])serializer.serialize(command, (AbstractSession)getCommandProcessor());
} finally {
this.commandProcessor.endOperationProfile(SessionProfiler.CacheCoordinationSerialize);
}
}
// Propagate the command (synchronously or asynchronously)
propagator = new CommandPropagator(this, newCommand, commandBytes);
if (shouldPropagateAsynchronously()) {
propagator.asynchronousPropagateCommand();
} else {
propagator.synchronousPropagateCommand();
}
} finally {
this.commandProcessor.endOperationProfile(SessionProfiler.CacheCoordination);
}
}