Interface ServerDetector

All Superinterfaces:
Comparable<ServerDetector>, JolokiaService<ServerDetector>

public interface ServerDetector extends JolokiaService<ServerDetector>, Comparable<ServerDetector>
A detector identifies a specific server. This is typically done by inspecting the runtime environment e.g. for the existence of certain classes. If a detector successfully detect 'its' server, it return a ServerHandle containing type, version and some optional information. For the early detection of a server by the JVM agent, jvmAgentStartup(Instrumentation) can be used. Using these methods is useful in case the server is using its own class loaders to load components used by Jolokia (e.g jmx, Java logging which is indirectly required by the sun.net.httpserver).
Since:
05.11.10
Author:
roland
  • Field Details

  • Method Details

    • getType

      default Class<ServerDetector> getType()
      Description copied from interface: JolokiaService
      The service type which is used to distinguish the various services. The service type is an extension of this base interface and add service specific methods to it
      Specified by:
      getType in interface JolokiaService<ServerDetector>
      Returns:
      service type
    • getName

      String getName()
      Name of the detector which should reflect the server to be detected
      Returns:
      server name
    • init

      void init(Map<String,Object> pConfig)
      Initialize with detector specific configuration.
      Parameters:
      pConfig - configuration which is key based map. Can be null if there is no configuration at all.
    • detect

      ServerHandle detect(MBeanServerAccess pMBeanServerAccess)
      Detect the server. A ServerHandle descriptor is returned in case of a successful detection, null otherwise.
      Parameters:
      pMBeanServerAccess - a set of MBeanServers which can be used for detecting server informations
      Returns:
      the server descriptor or null it this implementation cant detect 'its' server.
    • getMBeanServers

      Set<MBeanServerConnection> getMBeanServers()
      Add MBeanServers dedicated specifically on the identified platform. This method must be overridden by any platform wanting to add MBeanServers. By default this method does nothing.
      Returns:
      mbean servers which are specific for this server or null if none apply
    • getRequestInterceptor

      RequestInterceptor getRequestInterceptor(MBeanServerAccess pMBeanServerAccess)
      Get an request interceptor to add for dealing with server specific workarounds or behaviour
      Parameters:
      pMBeanServerAccess - for accessing the JMX subsystem
      Returns:
      a request interceptor to apply for this server or null if none is necessary.
    • getOrder

      int getOrder()
      Order of the service. The higher the number, the later in the list of services this service appears. Default order is 100.
      Specified by:
      getOrder in interface JolokiaService<ServerDetector>
      Returns:
      the order of this service
    • jvmAgentStartup

      void jvmAgentStartup(Instrumentation instrumentation)
      Notify detector that the JVM is about to start. A detector can, if needed, block and wait for some condition but should ultimatevely return at some point or throw an exception. This notification is executed in a very early stage (premain of the Jolokia JVM agent) before the main class of the Server is executed.
      Parameters:
      instrumentation - the Instrumentation implementation