|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.interceptor.AbstractInterceptor
Base class for all interceptors. This class provides some default method implementations for interceptors.
Interceptor
,
MBeanInvoker
Field Summary | |
protected boolean |
isShared
Indicates whether this interceptor instance is shared or not. |
protected org.jboss.logging.Logger |
log
Logger reference for interceptor implementations. |
protected String |
name
Name for this interceptor. |
Constructor Summary | |
AbstractInterceptor()
Constructs a new intereceptor instance. |
|
AbstractInterceptor(String name)
Constructs a new interceptor instance with a given name. |
Method Summary | |
void |
destroy()
This method is part of the interceptor lifecycle. |
String |
getName()
Returns the name of this interceptor. |
void |
init()
This method is part of the interceptor's lifecycle. |
Object |
invoke(Invocation invocation)
The default invoke implementation queries the invocation object for the next interceptor in the chain. |
boolean |
isShared()
Returns true if this interceptor is shared by multiple invokers; false otherwise. |
void |
setLogger(org.jboss.logging.Logger log)
Called by the MBeanInvoker on
a non-shared interceptors to set a logger reference for this interceptor. |
void |
setName(String name)
Sets a name for this interceptor. |
void |
start()
This method is part of the interceptor's lifecycle. |
void |
stop()
This method is part of the interceptor lifecycle. |
String |
toString()
Returns a string representation of this interceptor instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected String name
protected boolean isShared
protected org.jboss.logging.Logger log
Constructor Detail |
public AbstractInterceptor()
public AbstractInterceptor(String name)
name
- name of this interceptor
IllegalArgumentException
- if name contains null referenceMethod Detail |
public void setName(String name)
name
- public Object invoke(Invocation invocation) throws Throwable
Concrete implementations should override this method to implement their specific application logic.
invoke
in interface Interceptor
invocation
- the invocation object send towards the target
resource by the invoker
InvocationException
- This exception wraps any exceptions thrown
by either the target method of the resource object, or invocation
interceptors in this interceptor chain. The target exception is
unwrapped at the MBeanInvoker
instance.
Throwable
Invocation
,
MBeanInvoker
public String getName()
Interceptor
getName
in interface Interceptor
public boolean isShared()
Interceptor
isShared
in interface Interceptor
public void setLogger(org.jboss.logging.Logger log)
Interceptor
MBeanInvoker
on
a non-shared interceptors to set a logger reference for this interceptor.
The interceptor implementation may use the invoker's logger for recording
log information. Shared interceptors should set up their log facility through other means as they are invoked by several different MBean invokers. To access the log implementation of the originating invoker for a particular invocation, an interceptor may query they invocation context for invoker reference.
setLogger
in interface Interceptor
public void init() throws Exception
Interceptor
For shared interceptors the lifecycle is driven by the MBean registration. This method is called before the MBean is registered to the server.
Concrete interceptor implementations can override this method to provide initialization code that should be executed before the interceptor is registered.
Any exception that is propagated from this method to its caller will cancel the interceptor registration.
init
in interface Interceptor
Exception
- if you want to cancel the interceptor registrationpublic void start()
Interceptor
For shared interceptors the lifecycle is driven by the MBean registration.
This method is called after the MBean is registered to the
server as part of the
MBeanRegistration.postRegister(java.lang.Boolean)
execution.
Concrete interceptor implementations can override this method to provide initialization code that should be executed once the MBean server and object name references for this interceptor have been resolved.
start
in interface Interceptor
public void stop() throws Exception
Interceptor
For shared interceptors the lifecycle is driven by the MBean
unregistration. This method is called after the MBean is registered to the
server as part of the
MBeanRegistration.preDeregister()
execution.
Concrete interceptor implementations can override this method to provide cleanup code that should be executed before the interceptor is unregistered.
Any exception that is propagated from this method to its caller will cancel the interceptor unregistration.
stop
in interface Interceptor
Exception
- if you want to cancel the interceptor unregistrationpublic void destroy()
Interceptor
For shared interceptors the lifecycle is driven by the MBean
unregistration. This method is called after the MBean is registered to the
server as part of the
MBeanRegistration.postDeregister()
execution.
Concrete interceptor implementations can override this method to provide cleanup code that should be executed once the interceptor is no longer registered to the MBean server.
destroy
in interface Interceptor
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |