mx4j.util

Class 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.

Version:
$Revision: 1.3 $

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)

Method Details

get

public Object get(String methodName,
                  String[] signature)
Returns the method information given the method name and its signature.

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

splitFunction

protected int splitFunction(Object obj)

Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.