|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.mx.capability.OptimizedMBeanDispatcher
Byte code optimized dispatcher for Standard MBeans. This dispatcher generates an invoke implementation that handles the operation dispatching without Java reflection.
The use of this dispatcher may be controlled by setting a
OPTIMIZE_REFLECTED_DISPATCHER
property to either "true" or "false" string value.
ReflectedMBeanDispatcher
,
DispatchClassLoader
Field Summary |
Constructor Summary | |
OptimizedMBeanDispatcher()
|
Method Summary | |
protected static org.apache.bcel.generic.InstructionList |
convertObjectToPrimitive(org.apache.bcel.generic.ConstantPoolGen cp,
String type)
Converts a reference of a primitve wrapper object into a primite value type. |
protected static org.apache.bcel.generic.InstructionList |
convertPrimitiveToObject(org.apache.bcel.generic.ConstantPoolGen cp,
String type)
Converts a primitive into its corresponding object wrapper reference. |
static ReflectedMBeanDispatcher |
create(MBeanInfo info,
Object resource)
|
protected static org.apache.bcel.generic.MethodGen |
createConstructor(org.apache.bcel.generic.ConstantPoolGen cp,
String className)
creates constructor <init>(MBeanInfo info, AttributeOperationResolver resolver, Object resource) that calls super(info, resolver, resource) in its implementation |
protected static org.apache.bcel.generic.MethodGen |
createInvoke(org.apache.bcel.generic.ConstantPoolGen cp,
MBeanInfo info,
String className,
String resourceClassName)
Creates the implementation of the invoke(String actionName, Object[] args, String[] signature) method. |
static String |
getDescriptorForType(String name)
Returns a descriptor for a given Java type. |
static String |
getMethodDescriptor(MBeanParameterInfo[] signature,
String returnType)
Returns the signature of a MBean operation using the grammar required by the class file format, excluding the method name. |
protected static org.jboss.mx.capability.OptimizedMBeanDispatcher.MethodEntry[] |
getOperations(MBeanInfo info)
Returns a subset of MBean's operations. |
static boolean |
isPrimitive(String name)
Checks if a given name matches the TYPE name of a primitive wrapper class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OptimizedMBeanDispatcher()
Method Detail |
public static ReflectedMBeanDispatcher create(MBeanInfo info, Object resource)
public static String getMethodDescriptor(MBeanParameterInfo[] signature, String returnType)
MethodDescriptor: ( ParameterDescriptor* ) ReturnDescriptorA parameter descriptor represents a parameter passed to a method:
ParameterDescriptor: FieldTypeA return descriptor represents the type of the value returned from a method. It is a series of characters generated by the grammar:
ReturnDescriptor: FieldType VThe character V indicates that the method returns no value (its return type is void).
For example, the method descriptor for the method
Object mymethod(int i, double d, Thread t)is
(IDLjava/lang/Thread;)Ljava/lang/Object;Note that internal forms of the fully qualified names of Thread and Object are used in the method descriptor.
public static String getDescriptorForType(String name)
Class.getName()
for details on the grammar for arrays and primitive types. Note that the internal form of the fully
qualified name for class Object is used, so for example, the returned descriptor for
java.lang.Object is
Ljava/lang/Object;See JVM spec �4.2 and �4.3 for detailed description of the internal class name format and grammar notation.
name
- fully qualified name of the Java type
public static boolean isPrimitive(String name)
name
- TYPE.getName()
Integer.TYPE
protected static org.apache.bcel.generic.MethodGen createConstructor(org.apache.bcel.generic.ConstantPoolGen cp, String className)
cp
- constant poolclassName
- name of the class being generatedprotected static org.apache.bcel.generic.MethodGen createInvoke(org.apache.bcel.generic.ConstantPoolGen cp, MBeanInfo info, String className, String resourceClassName)
The Java equivalent of the implementation looks roughly as follows:
public void invoke(String actionName, Object[] args, String[] signature) { if (actionName != null) { try { if (actionName.equals(<operName1>)) return ((<resource type>)super.getResourceObject()).<operName1>((<arg1 type>)arg1, (<arg2 type>)arg2, ...); else if (actionName.equals(<operName2>)) return ((<resource type>)super.getResourceObject()).<operName2>((<arg1 type>)arg1, (<arg2 type>)arg2, ...); ... else super.invoke(actionName, args, signature); } catch (Throwable t) { super.invoke(actionName, args, signature); } } }
cp
- constant pool of the class being generatedinfo
- metadata of the MBeanclassName
- name of the class being generatedresourceClassName
- name of the resource class being invokedprotected static org.apache.bcel.generic.InstructionList convertObjectToPrimitive(org.apache.bcel.generic.ConstantPoolGen cp, String type)
cp
- constant pooltype
- class name of the primitive wrapper object to convert
protected static org.apache.bcel.generic.InstructionList convertPrimitiveToObject(org.apache.bcel.generic.ConstantPoolGen cp, String type)
cp
- constant pooltype
- type string of the primitive, for example Integer.TYPE.getName()
protected static org.jboss.mx.capability.OptimizedMBeanDispatcher.MethodEntry[] getOperations(MBeanInfo info)
Overloaded operations that differ in their arg list length may be able to gain in performance if implemented directly with byte code. Overloaded operations with equal arg list length may not show much difference compared to ternary search tree based resolver.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |