Package org.jolokia.service.jmx.handler
Class NotificationHandler
java.lang.Object
org.jolokia.service.jmx.handler.AbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>
org.jolokia.service.jmx.handler.NotificationHandler
- All Implemented Interfaces:
CommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>
public class NotificationHandler
extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>
A request handler which is responsible for managing notification
requests.
- Since:
- 19.03.13
- Author:
- roland
-
Field Summary
Fields inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
context, pProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckForRestriction(org.jolokia.server.core.request.JolokiaNotificationRequest pRequest) Check whether there is a restriction on the type to apply.doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess serverManager, org.jolokia.server.core.request.JolokiaNotificationRequest request, Object pPreviousResult) Default implementation fo handling a request for multiple servers at once.protected ObjectdoHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaNotificationRequest request) Abstract method to be subclassed by a concrete handler for performing the request.org.jolokia.server.core.util.RequestTypegetType()The type of request which can be served by this handlerbooleanhandleAllServersAtOnce(org.jolokia.server.core.request.JolokiaNotificationRequest pRequest) Override this if you want all servers as list in the argument, e.g.voidLifecycle method in order to initialize the handlerMethods inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
checkForModifiedSince, checkType, destroy, handleAllServerRequest, handleSingleServerRequest, isObjectNameHidden
-
Constructor Details
-
NotificationHandler
public NotificationHandler()
-
-
Method Details
-
init
Description copied from interface:CommandHandlerLifecycle method in order to initialize the handler- Specified by:
initin interfaceCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Overrides:
initin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Parameters:
pContext- the jolokia contextpProvider- provider to use for returned names. Handlers can use this for returning meta data with the proper provider prefixed.
-
getType
public org.jolokia.server.core.util.RequestType getType()The type of request which can be served by this handler- Returns:
- the request typ of this handler
-
handleAllServersAtOnce
public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaNotificationRequest pRequest) Override this if you want all servers as list in the argument, e.g. to query each server on your own. By default, dispatching of the servers are done for you- Specified by:
handleAllServersAtOncein interfaceCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Overrides:
handleAllServersAtOncein classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Parameters:
pRequest- request to decide on whether to handle all request at once- Returns:
- whether you want to have
CommandHandler.handleSingleServerRequest(MBeanServerConnection, JolokiaRequest)(false) orCommandHandler.handleAllServerRequest(MBeanServerAccess, JolokiaRequest, Object)(true) called.
-
checkForRestriction
protected void checkForRestriction(org.jolokia.server.core.request.JolokiaNotificationRequest pRequest) Check whether there is a restriction on the type to apply. This method should be overwritten by specific handlers if they support a more sophisticated check than only for the type- Specified by:
checkForRestrictionin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Parameters:
pRequest- request to check
-
doHandleSingleServerRequest
protected Object doHandleSingleServerRequest(MBeanServerConnection server, org.jolokia.server.core.request.JolokiaNotificationRequest request) Abstract method to be subclassed by a concrete handler for performing the request.- Specified by:
doHandleSingleServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Parameters:
server- server to tryrequest- request to process- Returns:
- the object result from the request
-
doHandleAllServerRequest
public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess serverManager, org.jolokia.server.core.request.JolokiaNotificationRequest request, Object pPreviousResult) throws ReflectionException, MBeanException, IOException, org.jolokia.server.core.request.EmptyResponseException Default implementation fo handling a request for multiple servers at once. A subclass, which returns,trueonAbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest), needs to override this method.- Overrides:
doHandleAllServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaNotificationRequest>- Parameters:
serverManager- all MBean servers found in this JVMrequest- the original requestpPreviousResult- a previous result which for merging requests can be used to merge files- Returns:
- the result of the the request.
- Throws:
ReflectionExceptionMBeanExceptionIOExceptionorg.jolokia.server.core.request.EmptyResponseException
-