Class ClientRemoteInvocationTraceInterceptor

  extended by
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

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

Utility interceptor that allows to intercept and log remote calls on client side. Instance of this class is created by appropriate ProxyFactoryBean which is used to create proxies to remote service.

Invocation log is perfomed on DEBUG level, Exceptions that are Errors or Runtime are logged on warn level, other exceptions are logged on info level.

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

Andrew Sazonov
See Also:

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

Field Detail


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


protected java.lang.String fProtocolName


protected java.lang.String fServiceKey
Constructor Detail


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

aProtocolName - the name of the cluster4spring protocol (to be used as context information in log messages)
Method Detail


public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation aInvocation)
                        throws java.lang.Throwable
Handles method invocation. Adds logging for invoked method as well as time of method executions. Log category that is used is org.softamis.cluster4spring.impl.ClientRemoteInvocationTraceInterceptor. Debug level for appropriate logger is DEBUG. If exception during invocation occured, it will be written to log with ERROR (for RuntimeException or Error) or with WARN level (otherwise).

Specified by:
invoke in interface org.aopalliance.intercept.MethodInterceptor
aInvocation - remote method invocation
result of method invocation execution
java.lang.Throwable - exception throwed by invocation