org.apache.felix.mosgi.jmx.agent.mx4j.util
Class MethodTernaryTree

java.lang.Object
  extended by org.apache.felix.mosgi.jmx.agent.mx4j.util.MethodTernaryTree

public class MethodTernaryTree
extends 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.

Version:
$Revision: 1.1.1.1 $
Author:
Simone Bordet

Constructor Summary
MethodTernaryTree()
           
 
Method Summary
 Object get(String methodName, String[] signature)
          Returns the method information given the method name and its signature.
 void put(String methodName, String[] signature, Object information)
          Inserts in this TernaryTree the given method information, using as key the method name and its signature
protected  int splitFunction(Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodTernaryTree

public MethodTernaryTree()
Method Detail

get

public Object get(String methodName,
                  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(String methodName,
                String[] signature,
                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(Object obj)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.