Package org.jolokia.jvmagent
Class JolokiaServer
java.lang.Object
org.jolokia.jvmagent.JolokiaServer
Factory for creating the HttpServer used for exporting
the Jolokia protocol
- Since:
- 12.08.11
- Author:
- roland, nevenr
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo 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.JolokiaServer(JolokiaServerConfig pConfig) 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 TypeMethodDescriptionprotected voidaddService(org.jolokia.server.core.service.api.JolokiaService<?> pService) Allow to add service from within a subclass.voidGet configuration for this servergetUrl()URL how this agent can be reached from the outside.protected final voidinit(JolokiaServerConfig pConfig, org.jolokia.server.core.service.api.LogHandler pLogHandler) Initialize this JolokiaServer and use an own created HttpServerprotected final voidinit(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.voidstart()Start this server.voidstart(boolean pLazy) Start this server.voidstop()Stop the HTTP server
-
Constructor Details
-
JolokiaServer
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 existingServerDetectorLookup- Parameters:
pConfig- configuration for this serverpLookup- 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 serverpLogHandler- log handler to use ornullif 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 usepConfig- configuration for this serverpLogHandler- log handler to use
-
JolokiaServer
protected JolokiaServer()No arg constructor usable by subclasses. Theinit(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
URL how this agent can be reached from the outside.- Returns:
- the agent URL
-
getServerConfig
Get configuration for this server- Returns:
- server configuration
-
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 usepLogHandler- 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. ExistingServerDetectorLookupcan be passed- Parameters:
pConfig- configuartion to usepLogHandler- log handler to usepLookup- 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 viestart(boolean)- Parameters:
pService- service to add
-
clearWatchedFiles
public void clearWatchedFiles() -
getWatchedFiles
-