org.softamis.cluster4spring.support
Class ClientRemoteInvocationTraceInterceptor
java.lang.Object
org.softamis.cluster4spring.support.ClientRemoteInvocationTraceInterceptor
- 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.
- Author:
- Andrew Sazonov
- See Also:
AbstractRmiProxyFactoryBean.setRegisterTraceInterceptor(boolean)
Field Summary |
protected static org.apache.commons.logging.Log |
fLog
|
protected java.lang.String |
fProtocolName
|
protected java.lang.String |
fServiceKey
|
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 |
fLog
protected static final org.apache.commons.logging.Log fLog
fProtocolName
protected java.lang.String fProtocolName
fServiceKey
protected java.lang.String fServiceKey
ClientRemoteInvocationTraceInterceptor
public ClientRemoteInvocationTraceInterceptor(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)
invoke
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
- Parameters:
aInvocation
- remote method invocation
- Returns:
- result of method invocation execution
- Throws:
java.lang.Throwable
- exception throwed by invocation