Class 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 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:
      • 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:
      • compareIntegralOrFloat

        public static boolean compareIntegralOrFloat​(Class c1,
                                                     Class c2)
      • getUniqueInvokerId

        public static String getUniqueInvokerId​(String suffix)