站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 jmx API Documentation 英文版文档

Interceptor (JBoss/JMX API) - JBoss 4.0.1 sp1 jmx API Documentation 英文版文档


org.jboss.mx.interceptor
Interface Interceptor

All Known Subinterfaces:
SharedInterceptor
All Known Implementing Classes:
AbstractInterceptor, AbstractSharedInterceptor

public interface Interceptor

This interface defines MBean interceptors. All MBean interceptors must implement this interface.

Version:
$Revision: 1.9 $
Author:
Juha Lindfors.
See Also:
AbstractInterceptor

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 invoke method is called when the invocation object passes this interceptor.
 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 start()
          This method is part of the interceptor's lifecycle.
 void stop()
          This method is part of the interceptor lifecycle.
 

Method Detail

getName

public String getName()
Returns the name of this interceptor. Notice that for shared interceptors this name must be unique among the shared interceptors in the MBean server.


isShared

public boolean isShared()
Returns true if this interceptor is shared by multiple invokers; false otherwise. Non-shared interceptors should always return false. Shared interceptors return false if they have not been registered to the MBean server yet. Shared interceptors must always return true after they have been registered to the server.

Returns:
true if shared;false otherwise

invoke

public Object invoke(Invocation invocation)
              throws Throwable
The invoke method is called when the invocation object passes this interceptor.

Throws:
Throwable

setLogger

public void setLogger(org.jboss.logging.Logger log)
Called by the 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.


init

public void init()
          throws Exception
This method is part of the interceptor's lifecycle. It is called by the invoker during the initialization of the interceptor instance.

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.

Throws:
Exception - if you want to cancel the interceptor registration

start

public void start()
This method is part of the interceptor's lifecycle. It is called by the invoker during the interceptor initialization process.

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.


stop

public void stop()
          throws Exception
This method is part of the interceptor lifecycle. It is called by the invoker during the interceptor removal.

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.

Throws:
Exception - if you want to cancel the interceptor unregistration

destroy

public void destroy()
This method is part of the interceptor lifecycle. It is called by the invoker durin the interceptor removal.

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.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.