mx4j.util
Class MethodTernaryTree
java.lang.Object
|
+--mx4j.util.MethodTernaryTree
- public class MethodTernaryTree
- extends java.lang.Object
Specialized ternary tree for method metadata information.
In JMX methods are referred to with the method name and the String[] representing the signature.
One can decide to cache method information using as key a concatenation of method name + signature,
but the cost of concatenation is very high, while hashmap access is fast.
Ternary trees avoid string concatenation, and result to be 10x faster than concatenation + hashmap.
However, the signature of a standard TernaryTree would be Object get(Object[] key)
and
void put(Object[] key, Object value)
. Unfortunately normalizing method name + signature
into a single array is also very expensive.
This version leaves method name and signature separated to have the fastest access possible to
method information.
See here for further information
on TernaryTrees.
Method Summary |
java.lang.Object |
get(java.lang.String methodName,
java.lang.String[] signature)
Returns the method information given the method name and its signature. |
void |
put(java.lang.String methodName,
java.lang.String[] signature,
java.lang.Object information)
Inserts in this TernaryTree the given method information, using as key the method name and its signature |
protected int |
splitFunction(java.lang.Object obj)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MethodTernaryTree
public MethodTernaryTree()
get
public java.lang.Object get(java.lang.String methodName,
java.lang.String[] signature)
- Returns the method information given the method name and its signature.
- See Also:
put(java.lang.String, java.lang.String[], java.lang.Object)
put
public void put(java.lang.String methodName,
java.lang.String[] signature,
java.lang.Object information)
- Inserts in this TernaryTree the given method information, using as key the method name and its signature
- See Also:
get(java.lang.String, java.lang.String[])
splitFunction
protected int splitFunction(java.lang.Object obj)