Class Config


  • public abstract class Config
    extends Object
    • Constructor Detail

      • Config

        public Config()
    • Method Detail

      • internalInitializeConfig

        public static void internalInitializeConfig​(Config config)
        Sets the agent configuration singleton. This method is only supposed to be called once, from the agent classloader just before the first instrumentation is loaded (and before get() is used for the first time).
      • get

        public static Config get()
      • getProperty

        public String getProperty​(String name,
                                  String defaultValue)
        Retrieves a property value from the agent configuration consisting of system properties, environment variables and contents of the agent configuration file (see ConfigInitializer and ConfigBuilder).

        In case any get*Property() method variant gets called for the same property more than once (e.g. each time an advice executes) it is suggested to cache the result instead of repeatedly calling Config. Agent configuration does not change during the runtime so retrieving the property once and storing its result in e.g. static final field allows JIT to do its magic and remove some code branches.

        Returns:
        A string property value or defaultValue if a property with name name did not exist.
      • getBooleanProperty

        public boolean getBooleanProperty​(String name,
                                          boolean defaultValue)
        Returns a boolean property value or defaultValue if a property with name name did not exist.
        See Also:
        getProperty(String, String)
      • isInstrumentationEnabled

        public boolean isInstrumentationEnabled​(Iterable<String> instrumentationNames,
                                                boolean defaultEnabled)
      • isInstrumentationPropertyEnabled

        public boolean isInstrumentationPropertyEnabled​(Iterable<String> instrumentationNames,
                                                        String suffix,
                                                        boolean defaultEnabled)
      • asJavaProperties

        public Properties asJavaProperties()