org.jboss.byteman.agent
Class HelperManager

java.lang.Object
  extended by org.jboss.byteman.agent.HelperManager

public class HelperManager
extends java.lang.Object

class used to manage lifecycle events for rule helpers


Nested Class Summary
private static class HelperManager.LifecycleDetails
          a record of a specific helper class tracking the number of installed rules which reference it and referencing a table detailing the lifecycle methods it implements
 
Field Summary
private static java.lang.String ACTIVATED_NAME
          name of method invoked when helper installed count transitions from 0 to positive
private static java.lang.Class[] ACTIVATED_SIGNATURE
          param types of method invoked when helper installed count transitions from 0 to positive
private static java.lang.String DEACTIVATED_NAME
          name of method invoked when helper installed count transitions from positive to 0
private static java.lang.Class[] DEACTIVATED_SIGNATURE
          param types of method invoked when helper installed count transitions from positive to 0
private  java.util.concurrent.ConcurrentHashMap<java.lang.Class<?>,HelperManager.LifecycleDetails> helperDetailsMap
          a hashmap from helper classes to their corresponding helper details.
private  java.lang.instrument.Instrumentation inst
          the instrumentation object used to install the transformer.
private static java.lang.String INSTALLED_NAME
          name of method invoked when rule is installed for a given helper
private static java.lang.Class[] INSTALLED_RULE_SIGNATURE
          param types of method invoked when rule is installed for a given helper
private static java.lang.Class[] INSTALLED_STRING_SIGNATURE
          param types of method invoked when rule is installed for a given helper
private static java.lang.String UNINSTALLED_NAME
          name of method invoked when rule is uninstalled for a given helper
private static java.lang.Class[] UNINSTALLED_RULE_SIGNATURE
          param types of method invoked when rule is uninstalled for a given helper
private static java.lang.Class[] UNINSTALLED_STRING_SIGNATURE
          param types of method invoked when rule is uninstalled for a given helper
 
Constructor Summary
HelperManager(java.lang.instrument.Instrumentation inst)
          construct a manager
 
Method Summary
private  HelperManager.LifecycleDetails getDetails(java.lang.Class<?> helperClass, boolean createIfAbsent)
          lookup or create a record describing the lifecycle methods of a helper class.
 void installed(Rule rule)
           
private  java.lang.reflect.Method lookupLifecycleMethod(java.lang.Class<?> clazz, java.lang.String name, java.lang.Class<?>[] paramTypes)
          return a static public method with the given parameter types it exists otherwise null
private  void purgeDetails(HelperManager.LifecycleDetails details)
          purge the details describing the lifecycle methods of a helper class.
 void uninstalled(Rule rule)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inst

private java.lang.instrument.Instrumentation inst
the instrumentation object used to install the transformer. If this is null then we are not running in a real agent so we do no work.


helperDetailsMap

private java.util.concurrent.ConcurrentHashMap<java.lang.Class<?>,HelperManager.LifecycleDetails> helperDetailsMap
a hashmap from helper classes to their corresponding helper details. we don't use weak references here because there is only ever an entry here if there is a rule installed which references the class. entries get cleared when the rules are uninstalled.


ACTIVATED_NAME

private static final java.lang.String ACTIVATED_NAME
name of method invoked when helper installed count transitions from 0 to positive

See Also:
Constant Field Values

DEACTIVATED_NAME

private static final java.lang.String DEACTIVATED_NAME
name of method invoked when helper installed count transitions from positive to 0

See Also:
Constant Field Values

INSTALLED_NAME

private static final java.lang.String INSTALLED_NAME
name of method invoked when rule is installed for a given helper

See Also:
Constant Field Values

UNINSTALLED_NAME

private static final java.lang.String UNINSTALLED_NAME
name of method invoked when rule is uninstalled for a given helper

See Also:
Constant Field Values

ACTIVATED_SIGNATURE

private static final java.lang.Class[] ACTIVATED_SIGNATURE
param types of method invoked when helper installed count transitions from 0 to positive


DEACTIVATED_SIGNATURE

private static final java.lang.Class[] DEACTIVATED_SIGNATURE
param types of method invoked when helper installed count transitions from positive to 0


INSTALLED_RULE_SIGNATURE

private static final java.lang.Class[] INSTALLED_RULE_SIGNATURE
param types of method invoked when rule is installed for a given helper


UNINSTALLED_RULE_SIGNATURE

private static final java.lang.Class[] UNINSTALLED_RULE_SIGNATURE
param types of method invoked when rule is uninstalled for a given helper


INSTALLED_STRING_SIGNATURE

private static final java.lang.Class[] INSTALLED_STRING_SIGNATURE
param types of method invoked when rule is installed for a given helper


UNINSTALLED_STRING_SIGNATURE

private static final java.lang.Class[] UNINSTALLED_STRING_SIGNATURE
param types of method invoked when rule is uninstalled for a given helper

Constructor Detail

HelperManager

public HelperManager(java.lang.instrument.Instrumentation inst)
construct a manager

Parameters:
inst - will be non-null if
Method Detail

installed

public void installed(Rule rule)

uninstalled

public void uninstalled(Rule rule)

getDetails

private HelperManager.LifecycleDetails getDetails(java.lang.Class<?> helperClass,
                                                  boolean createIfAbsent)
lookup or create a record describing the lifecycle methods of a helper class. this must only be called when synchronized on the helper class.

Parameters:
helperClass -
createIfAbsent - if the details are not present and this is true then create and install new details
Returns:
the relevant details

lookupLifecycleMethod

private java.lang.reflect.Method lookupLifecycleMethod(java.lang.Class<?> clazz,
                                                       java.lang.String name,
                                                       java.lang.Class<?>[] paramTypes)
return a static public method with the given parameter types it exists otherwise null

Parameters:
name -
paramTypes -
Returns:

purgeDetails

private void purgeDetails(HelperManager.LifecycleDetails details)
purge the details describing the lifecycle methods of a helper class. this must only be called when synchronized on the helper class.

Parameters:
details -