|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.mx.remoting.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:
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.
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()});
Field Summary | |
protected java.lang.Integer |
hashCode
|
protected MBeanLocator (src) |
locator
|
protected java.util.Map |
staticAttributes
|
Constructor Summary | |
protected |
MoveableMBean(MBeanLocator (src) locator,
java.util.Map staticAttributes)
|
Method Summary | |
void |
addStaticAttribute(java.lang.String name,
java.lang.Object value)
add a static attribute |
void |
addStaticAttributes(java.util.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 java.lang.Object |
create(MBeanLocator (src) locater,
java.lang.Class interfaceClass)
|
static java.lang.Object |
create(MBeanLocator (src) locator,
java.lang.Class[] interfaces)
|
static java.lang.Object |
create(MBeanLocator (src) locator,
java.lang.ClassLoader loader,
java.lang.Class interfaceClass)
|
static java.lang.Object |
create(MBeanLocator (src) locator,
java.lang.ClassLoader loader,
java.lang.Class[] interfaces,
java.util.Map staticAttributes)
|
static java.lang.Object |
create(MBeanLocator (src) locator,
java.lang.ClassLoader loader,
java.lang.Class interfaceClass,
java.util.Map staticAttributes)
|
MBeanLocator (src) |
getMBeanLocator()
return the locator that the mbean references |
protected java.lang.Object |
handleLocationMethods(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
protected java.lang.Object |
handleObjectMethods(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Processes a method invocation on a proxy instance and returns the result. |
protected java.lang.String[] |
makeArgSignature(java.lang.reflect.Method method,
java.lang.Object[] args)
convert the method to a String array for the signature of the MBean invocation |
protected java.lang.Boolean |
proxyEquals(java.lang.Object proxy,
java.lang.Object other)
|
protected java.lang.Integer |
proxyHashCode(java.lang.Object proxy)
|
protected java.lang.String |
proxyToString(java.lang.Object proxy)
|
protected java.lang.Class |
resolveProxyClass(java.lang.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 (src) locator
protected java.lang.Integer hashCode
protected java.util.Map staticAttributes
Constructor Detail |
protected MoveableMBean(MBeanLocator (src) locator, java.util.Map staticAttributes)
Method Detail |
public final MBeanLocator (src) getMBeanLocator()
public static java.lang.Object create(MBeanLocator (src) locator, java.lang.ClassLoader loader, java.lang.Class interfaceClass)
public static java.lang.Object create(MBeanLocator (src) locator, java.lang.ClassLoader loader, java.lang.Class interfaceClass, java.util.Map staticAttributes)
public static java.lang.Object create(MBeanLocator (src) locater, java.lang.Class interfaceClass)
public static java.lang.Object create(MBeanLocator (src) locator, java.lang.Class[] interfaces)
public static java.lang.Object create(MBeanLocator (src) locator, java.lang.ClassLoader loader, java.lang.Class[] interfaces, java.util.Map staticAttributes)
public void addStaticAttributes(java.util.Map values)
values
- public void addStaticAttribute(java.lang.String name, java.lang.Object value)
name
- value
- protected java.lang.Object handleLocationMethods(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invoke
in interface java.lang.reflect.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.
java.lang.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 java.lang.Boolean proxyEquals(java.lang.Object proxy, java.lang.Object other)
protected java.lang.String proxyToString(java.lang.Object proxy)
protected java.lang.Integer proxyHashCode(java.lang.Object proxy)
protected java.lang.Object handleObjectMethods(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Exception
java.lang.Exception
protected java.lang.String[] makeArgSignature(java.lang.reflect.Method method, java.lang.Object[] args)
method
- args
-
protected java.lang.Class resolveProxyClass(java.lang.String[] interfaces) throws java.io.IOException, java.lang.ClassNotFoundException
interfaces
-
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS (src) NEXT CLASS (src) | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |