Class JolokiaServer

java.lang.Object
org.jolokia.jvmagent.JolokiaServer

public class JolokiaServer extends Object
Factory for creating the HttpServer used for exporting the Jolokia protocol
Since:
12.08.11
Author:
roland, nevenr
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    No arg constructor usable by subclasses.
     
    JolokiaServer(HttpServer pServer, JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler)
    Create the Jolokia server by using an existing HttpServer to which a request handler gets added.
     
    Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests.
     
    JolokiaServer(JolokiaServerConfig pConfig, org.jolokia.server.core.detector.ServerDetectorLookup pLookup)
    Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests.
     
    JolokiaServer(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler)
    Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addService(org.jolokia.server.core.service.api.JolokiaService<?> pService)
    Allow to add service from within a subclass.
     
    Get configuration for this server
    URL how this agent can be reached from the outside.
    protected final void
    init(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler)
    Initialize this JolokiaServer and use an own created HttpServer
    protected final void
    init(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler, org.jolokia.server.core.detector.ServerDetectorLookup pLookup)
    Initialize this JolokiaServer and use an own created HttpServer.
    void
    Start this server.
    void
    start(boolean pLazy)
    Start this server.
    void
    Stop the HTTP server

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JolokiaServer

      public JolokiaServer(JolokiaServerConfig pConfig) throws IOException
      Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests. This uses a loghandler which prints out to stdout.
      Parameters:
      pConfig - configuration for this server
      Throws:
      IOException - if initialization fails
    • JolokiaServer

      public JolokiaServer(JolokiaServerConfig pConfig, org.jolokia.server.core.detector.ServerDetectorLookup pLookup) throws IOException
      Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests. This uses a loghandler which prints out to stdout and allows to pass existing ServerDetectorLookup
      Parameters:
      pConfig - configuration for this server
      pLookup - existing server detector lookup to use
      Throws:
      IOException - if initialization fails
    • JolokiaServer

      public JolokiaServer(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler) throws IOException
      Create the Jolokia server which in turn creates an HttpServer for serving Jolokia requests.
      Parameters:
      pConfig - configuration for this server
      pLogHandler - log handler to use or null if logging should go to stdout
      Throws:
      IOException - if initialization fails
    • JolokiaServer

      public JolokiaServer(HttpServer pServer, JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler)
      Create the Jolokia server by using an existing HttpServer to which a request handler gets added.
      Parameters:
      pServer - HttpServer to use
      pConfig - configuration for this server
      pLogHandler - log handler to use
    • JolokiaServer

      protected JolokiaServer()
      No arg constructor usable by subclasses. The init(JolokiaServerConfig,LogHandler) must be called later on for initialization
  • Method Details

    • start

      public void start()
      Start this server. If we manage an own HttpServer, then the HttpServer will be started as well.
    • start

      public void start(boolean pLazy)
      Start this server. If we manage an own HttpServer, then the HttpServer will be started as well.
      Parameters:
      pLazy - if set to true Jolokia is initialized on the first request which allows (hopefully) the rest to initialize properly
    • stop

      public void stop()
      Stop the HTTP server
    • getUrl

      public String getUrl()
      URL how this agent can be reached from the outside.
      Returns:
      the agent URL
    • getServerConfig

      public JolokiaServerConfig getServerConfig()
      Get configuration for this server
      Returns:
      server configuration
    • getAddress

      public InetSocketAddress getAddress()
      Returns:
      the address that the server is listening on. Thus, a program can initialize the server with 'port 0' and then retrieve the actual running port that was bound.
    • init

      protected final void init(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler) throws IOException
      Initialize this JolokiaServer and use an own created HttpServer
      Parameters:
      pConfig - configuartion to use
      pLogHandler - log handler to use
      Throws:
      IOException - if the creation of the HttpServer fails
    • init

      protected final void init(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler, org.jolokia.server.core.detector.ServerDetectorLookup pLookup) throws IOException
      Initialize this JolokiaServer and use an own created HttpServer. Existing ServerDetectorLookup can be passed
      Parameters:
      pConfig - configuartion to use
      pLogHandler - log handler to use
      pLookup - existing server detector lookup to use
      Throws:
      IOException - if the creation of the HttpServer fails
    • addService

      protected void addService(org.jolokia.server.core.service.api.JolokiaService<?> pService)
      Allow to add service from within a subclass. This method should be called before this server is started vie start(boolean)
      Parameters:
      pService - service to add