Package org.glassfish.flashlight
Class FlashlightUtils
- java.lang.Object
-
- org.glassfish.flashlight.FlashlightUtils
-
public class FlashlightUtils extends Object
Note that you MUST call an initilizer for this class for DTrace! Why? We do not want the overhead of being a Service that implements a Contract which is what you need to get a habitat object! // TODO -- just make this a Service and inject the habitat and simplify the code a bit!- Author:
- Byron Nevins
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleancompareIntegral(Class c1, Class c2)return true if they are the same -- ignoring boxing/unboxing AND if they are "integrals"static booleancompareIntegralOrFloat(Class c1, Class c2)static DTraceContractgetDtraceEngine()static String[]getParamNames(Method method)bnevins -- I see 2 exact copies of this big chunk of code -- so I moved it here! bnevins Oct 18, 2009 -- I can't see any reason why we FORCE users to annotate every single parameter! We should just make a name up if they don't provide one.static List<Method>getProbeMethods(Class<?> clazz)return the Methods in the clazz that are annotated as Probe.static StringgetUniqueInvokerId(String suffix)static voidinitialize(org.glassfish.hk2.api.ServiceLocator h, MonitoringService mc)static booleanisDtraceAvailable()static booleanisDtraceEnabled()This only reveals whether it is enabled in domain.xml isDtraceAvailable() checks this AND a few other thingsstatic booleanisIntegral(Class clazz)static booleanisIntegralOrFloat(Class clazz)static booleanisLegalDtraceParam(Class clazz)static booleanisMonitoringEnabled()static StringmakeName(String a, String b, String c)static StringmakeName(FlashlightProbeProvider provider)static voidsetDTraceEnabled(boolean b)static voidsetMonitoringEnabled(boolean b)
-
-
-
Method Detail
-
initialize
public static void initialize(org.glassfish.hk2.api.ServiceLocator h, MonitoringService mc)
-
setDTraceEnabled
public static void setDTraceEnabled(boolean b)
-
setMonitoringEnabled
public static void setMonitoringEnabled(boolean b)
-
isMonitoringEnabled
public static boolean isMonitoringEnabled()
-
isDtraceAvailable
public static boolean isDtraceAvailable()
-
isDtraceEnabled
public static boolean isDtraceEnabled()
This only reveals whether it is enabled in domain.xml isDtraceAvailable() checks this AND a few other things- Returns:
-
getDtraceEngine
public static DTraceContract getDtraceEngine()
-
getParamNames
public static String[] getParamNames(Method method)
bnevins -- I see 2 exact copies of this big chunk of code -- so I moved it here! bnevins Oct 18, 2009 -- I can't see any reason why we FORCE users to annotate every single parameter! We should just make a name up if they don't provide one. Since such names are not saved to the byte code it can't have any runtime effect.- Parameters:
method-- Returns:
-
getProbeMethods
public static List<Method> getProbeMethods(Class<?> clazz)
return the Methods in the clazz that are annotated as Probe. Note that we use getMethods() not getDeclaredMethods() This allows a hierarchy of Probe Providers- Parameters:
clazz-- Returns:
- a List of legal Methods null will never be returned.
-
isLegalDtraceParam
public static boolean isLegalDtraceParam(Class clazz)
-
isIntegral
public static boolean isIntegral(Class clazz)
-
isIntegralOrFloat
public static boolean isIntegralOrFloat(Class clazz)
-
compareIntegral
public static boolean compareIntegral(Class c1, Class c2)
return true if they are the same -- ignoring boxing/unboxing AND if they are "integrals"- Parameters:
c1-c2-- Returns:
-
makeName
public static String makeName(FlashlightProbeProvider provider)
-
-