Package org.jolokia.service.jmx.handler
Class ReadHandler
java.lang.Object
org.jolokia.service.jmx.handler.AbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
org.jolokia.service.jmx.handler.ReadHandler
- All Implemented Interfaces:
CommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
public class ReadHandler
extends AbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>
Handler for managing READ requests for reading attributes.
- Since:
- Jun 12, 2009
- 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.JolokiaReadRequest pRequest) Check whether there is a restriction on the type to apply.doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess jmxAccess, org.jolokia.server.core.request.JolokiaReadRequest pRequest, Object pPreviousResult) Default implementation for handling a request for multiple servers at once.doHandleSingleServerRequest(MBeanServerConnection pServer, org.jolokia.server.core.request.JolokiaReadRequest pRequest) Used for a request for a single attribute from a single MBean.org.jolokia.server.core.util.RequestTypegetType()The type of request which can be handledbooleanhandleAllServersAtOnce(org.jolokia.server.core.request.JolokiaReadRequest pRequest) For simple requests (one MBean, no pattern, one attribute) we use theMBeanServerAccess.call(ObjectName, MBeanServerAccess.MBeanAction, Object...)to quickly return first available result.Methods inherited from class org.jolokia.service.jmx.handler.AbstractCommandHandler
checkForModifiedSince, checkType, destroy, handleAllServerRequest, handleSingleServerRequest, init, isObjectNameHidden
-
Constructor Details
-
ReadHandler
public ReadHandler()
-
-
Method Details
-
getType
public org.jolokia.server.core.util.RequestType getType()Description copied from interface:CommandHandlerThe type of request which can be handled- Returns:
- the request type of this handler
-
checkForRestriction
protected void checkForRestriction(org.jolokia.server.core.request.JolokiaReadRequest pRequest) Description copied from class:AbstractCommandHandlerCheck 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.JolokiaReadRequest>- Parameters:
pRequest- request to check
-
handleAllServersAtOnce
public boolean handleAllServersAtOnce(org.jolokia.server.core.request.JolokiaReadRequest pRequest) For simple requests (one MBean, no pattern, one attribute) we use theMBeanServerAccess.call(ObjectName, MBeanServerAccess.MBeanAction, Object...)to quickly return first available result. If the request is for an MBean pattern or multiple (or all) attributes are required, we combine multiple requests for multiple servers.- Specified by:
handleAllServersAtOncein interfaceCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Overrides:
handleAllServersAtOncein classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pRequest- request to decide on whether to handle all request at once- Returns:
- true if this is a multi attribute request, has an MBean pattern to look for or is a request for all attributes.
-
doHandleSingleServerRequest
public Object doHandleSingleServerRequest(MBeanServerConnection pServer, org.jolokia.server.core.request.JolokiaReadRequest pRequest) throws IOException, JMException Used for a request for a single attribute from a single MBean.- Specified by:
doHandleSingleServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
pServer- server on which to request the attributepRequest- the request itself.- Returns:
- the attribute's value
- Throws:
IOException- when there's an error invokingMBeanServerConnectionJMException- JMX checked exception, because most requests are handled by dealing with MBeans
-
doHandleAllServerRequest
public Object doHandleAllServerRequest(org.jolokia.server.core.util.jmx.MBeanServerAccess jmxAccess, org.jolokia.server.core.request.JolokiaReadRequest pRequest, Object pPreviousResult) throws IOException, JMException Description copied from class:AbstractCommandHandlerDefault implementation for handling a request for multiple servers at once. A subclass, which returns,truefromAbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest), needs to override this method. IfAbstractCommandHandler.handleAllServersAtOnce(JolokiaRequest)returnsfalse, the iteration over availableconnectionsis performed by the caller (RequestHandler).- Overrides:
doHandleAllServerRequestin classAbstractCommandHandler<org.jolokia.server.core.request.JolokiaReadRequest>- Parameters:
jmxAccess- all MBean servers found in this JVMpRequest- the original requestpPreviousResult- a previous result which for merging requests can be used to merge the data- Returns:
- the result of the the request.
- Throws:
IOException- when there's an error invokingMBeanServerConnectionJMException- JMX checked exception, because most requests are handled by dealing with MBeans
-