|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.remoting.MoveableMBean
public class MoveableMBean
MoveableMBean is a Dynamic Proxy to an MBean that exists on a JMX Network. This object can be created an cast to the appropriate set of interfaces that the MBean implements and can be serialized and past across the network and serialization and remote invocation will be handled as if the Object was local to the JVM.
Example usage:
TestMBean mybean=(TestMBean)MoveableMBean.create(mbeanLocator,TestMBean.class);
// transport method
mybean.myMethod();
// transport a method against a remote JMX server and pass the TestMBean object
// it will be serialized and passed to the remote server .. on the other side, the
// JVM will de-serialize, create a local DynamicProxy and then invocations against the
// parameter, will be invoked remotely back to the mbeanLocator above
remoteserver.transport(new ObjectName(":test=MyObject"),"myMethod",new Object[]{mybean},new String[]{TestMBean.class.getName()});
You can also cache attribute values in the local proxy, in the case where the values are fixed
and you don't want to remote overhead associated with sending the invocation remotely. In this case,
you can pass in a Map of attribute/value pairs which will be always returned in any getter method invocation
against the attribute.
Field Summary | |
---|---|
protected Integer |
hashCode
|
protected MBeanLocator |
locator
|
protected Map |
staticAttributes
|
Constructor Summary | |
---|---|
protected |
MoveableMBean(MBeanLocator locator,
Map staticAttributes)
|
Method Summary | |
---|---|
void |
addStaticAttribute(String name,
Object value)
add a static attribute |
void |
addStaticAttributes(Map values)
add a map of static attributes, with each key being the attributeName and the value being the value to return for every invocation to this attribute getter |
static Object |
create(MBeanLocator locater,
Class interfaceClass)
|
static Object |
create(MBeanLocator locator,
Class[] interfaces)
|
static Object |
create(MBeanLocator locator,
ClassLoader loader,
Class interfaceClass)
|
static Object |
create(MBeanLocator locator,
ClassLoader loader,
Class[] interfaces,
Map staticAttributes)
|
static Object |
create(MBeanLocator locator,
ClassLoader loader,
Class interfaceClass,
Map staticAttributes)
|
MBeanLocator |
getMBeanLocator()
return the locator that the mbean references |
protected Object |
handleLocationMethods(Object proxy,
Method method,
Object[] args)
|
protected Object |
handleObjectMethods(Object proxy,
Method method,
Object[] args)
|
Object |
invoke(Object proxy,
Method method,
Object[] args)
Processes a method invocation on a proxy instance and returns the result. |
protected String[] |
makeArgSignature(Method method,
Object[] args)
convert the method to a String array for the signature of the MBean invocation |
protected Boolean |
proxyEquals(Object proxy,
Object other)
|
protected Integer |
proxyHashCode(Object proxy)
|
protected String |
proxyToString(Object proxy)
|
protected Class |
resolveProxyClass(String[] interfaces)
resolve the proxy interfaces |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MBeanLocator locator
protected Integer hashCode
protected Map staticAttributes
Constructor Detail |
---|
protected MoveableMBean(MBeanLocator locator, Map staticAttributes)
Method Detail |
---|
public final MBeanLocator getMBeanLocator()
public static Object create(MBeanLocator locator, ClassLoader loader, Class interfaceClass)
public static Object create(MBeanLocator locator, ClassLoader loader, Class interfaceClass, Map staticAttributes)
public static Object create(MBeanLocator locater, Class interfaceClass)
public static Object create(MBeanLocator locator, Class[] interfaces)
public static Object create(MBeanLocator locator, ClassLoader loader, Class[] interfaces, Map staticAttributes)
public void addStaticAttributes(Map values)
values
- public void addStaticAttribute(String name, Object value)
name
- value
- protected Object handleLocationMethods(Object proxy, Method method, Object[] args) throws Throwable
Throwable
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke
in interface InvocationHandler
proxy
- the proxy instance that the method was invoked onmethod
- the Method
instance corresponding to
the interface method invoked on the proxy instance. The declaring
class of the Method
object will be the interface that
the method was declared in, which may be a superinterface of the
proxy interface that the proxy class inherits the method through.args
- an array of objects containing the values of the
arguments passed in the method invocation on the proxy instance,
or null
if interface method takes no arguments.
Arguments of primitive types are wrapped in instances of the
appropriate primitive wrapper class, such as
java.lang.Integer
or java.lang.Boolean
.
null
and the interface method's return type is
primitive, then a NullPointerException
will be
thrown by the method invocation on the proxy instance. If the
value returned by this method is otherwise not compatible with
the interface method's declared return type as described above,
a ClassCastException
will be thrown by the method
invocation on the proxy instance.
Throwable
- the exception to throw from the method
invocation on the proxy instance. The exception's type must be
assignable either to any of the exception types declared in the
throws
clause of the interface method or to the
unchecked exception types java.lang.RuntimeException
or java.lang.Error
. If a checked exception is
thrown by this method that is not assignable to any of the
exception types declared in the throws
clause of
the interface method, then an
UndeclaredThrowableException
containing the
exception that was thrown by this method will be thrown by the
method invocation on the proxy instance.UndeclaredThrowableException
protected Boolean proxyEquals(Object proxy, Object other)
protected String proxyToString(Object proxy)
protected Integer proxyHashCode(Object proxy)
protected Object handleObjectMethods(Object proxy, Method method, Object[] args) throws Exception
Exception
protected String[] makeArgSignature(Method method, Object[] args)
method
- args
-
protected Class resolveProxyClass(String[] interfaces) throws IOException, ClassNotFoundException
interfaces
-
IOException
ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |