org.softamis.cluster4spring.support
Class ServerRemoteInvocationTraceInterceptor

java.lang.Object
  extended by org.softamis.cluster4spring.support.ServerRemoteInvocationTraceInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class ServerRemoteInvocationTraceInterceptor
extends java.lang.Object
implements org.aopalliance.intercept.MethodInterceptor

AOP Alliance MethodInterceptor for tracing remote invocations. Automatically applied by RemoteExporter and its subclasses.

Logs an incoming remote call as well as the finished processing of a remote call at DEBUG level. If the processing of a remote call results in a checked exception, the exception will get logged at INFO level; if it results in an unchecked exception (or error), the exception will get logged at WARN level.

In addition, interceptors prints information about time spent for remote method invocation.

The logging of exceptions is particularly useful to save the stacktrace information on the server-side rather than just propagating the exception to the client (who might or might not log it properly).

Since:
1.2
Author:
Andrew Sazonov
See Also:
RemoteExporter.setRegisterTraceInterceptor(boolean), RemoteExporter.getProxyForService()

Field Summary
protected  java.lang.String fExporterName
           
protected static org.apache.commons.logging.Log fLogger
           
protected  java.lang.String fServiceKey
           
 
Constructor Summary
ServerRemoteInvocationTraceInterceptor(java.lang.String aProtocolName, java.lang.String aServiceKey)
          Create a new RemoteInvocationTraceInterceptor.
 
Method Summary
 java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation aInvocation)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLogger

protected static final org.apache.commons.logging.Log fLogger

fExporterName

protected java.lang.String fExporterName

fServiceKey

protected java.lang.String fServiceKey
Constructor Detail

ServerRemoteInvocationTraceInterceptor

public ServerRemoteInvocationTraceInterceptor(java.lang.String aProtocolName,
                                              java.lang.String aServiceKey)
Create a new RemoteInvocationTraceInterceptor.

Parameters:
aProtocolName - the name of the cluster4spring protocol (to be used as context information in log messages)
aServiceKey - key used to denote a service
Method Detail

invoke

public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation aInvocation)
                        throws java.lang.Throwable
Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
Throws:
java.lang.Throwable