if (msg instanceof RemotingMessage)
{
RemotingMessage message = (RemotingMessage)msg;
RemotingDestination destination = (RemotingDestination)getDestination(msg);
RemotingDestinationControl destinationControl = (destination.isManaged()) ? (RemotingDestinationControl)destination.getControl() : null;
if (destination != null)
{
ServiceAdapter adapter = destination.getAdapter();
long startTime = 0;
if (destinationControl != null)
startTime = System.currentTimeMillis();
try
{
MessagePerformanceUtils.markServerPreAdapterTime(message);
Object result = adapter.invoke(message);
MessagePerformanceUtils.markServerPostAdapterTime(message);
if (Log.isDebug())
{
Log.getLogger(LOG_CATEGORY).debug("Adapter '{0}' called '{1}.{2}({3})'",
new Object[] {adapter.getId(),
message.getSource(),
message.getOperation(),
message.getParameters()});
Log.getLogger(LOG_CATEGORY).debug("Result: '{0}'", new Object[] {result});
}
if (destinationControl != null)
{
// Record a successful invocation and its processing duration.
// Cast to an int is safe because no remoting invocation will have a longer duration in millis than Integer.MAX_VALUE.
destinationControl.incrementInvocationSuccessCount((int)(System.currentTimeMillis() - startTime));
}
return result;
}
catch (MessageException ex)
{
if (destinationControl != null)
{
// Record a faulted invocation and its processing duration.
// Cast to an int is safe because no remoting invocation will have a longer duration in millis than Integer.MAX_VALUE.
destinationControl.incrementInvocationFaultCount((int)(System.currentTimeMillis() - startTime));
}
throw ex;
}
catch (Throwable t)
{
if (destinationControl != null)
{
// Record a faulted invocation and its processing duration.
// Cast to an int is safe because no remoting invocation will have a longer duration in millis than Integer.MAX_VALUE.
destinationControl.incrementInvocationFaultCount((int)(System.currentTimeMillis() - startTime));
}
throw new MessageException(t);
}
}