@ComponentProfile(summary="Execute a JMX operation", tag="service,jmx", since="3.6.5") public class DynamicJmxOperationService extends JmxOperationImpl
JMXServiceURL
s and execute JMX Operations.
Note that because of the dynamic nature of this service, it does not support username/password/jmx-environment that are supported
by JmxConnection
. If it can be defined in the URL, then it should be (e.g. jmx+jms rather than jmxmp). A small
(configurable) cache of connections is kept for performance reasons. This is emptied whenever the service is stopped.
Note that parameters are not configurable in the same way, so this is really designed for calling the same operation
for
different ObjectName
instances on different JMXServiceURL
s.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_MAX_CACHE_SIZE |
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
DynamicJmxOperationService() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeService() |
void |
doService(AdaptrisMessage msg)
Apply the service to the message.
|
java.lang.String |
getJmxServiceUrl() |
java.lang.Integer |
getMaxJmxConnectionCache()
Get the max number of entries in the cache.
|
ValueTranslator |
getResultValueTranslator() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setJmxServiceUrl(java.lang.String s)
The JMX Service URL to target.
|
void |
setMaxJmxConnectionCache(java.lang.Integer maxSize)
Set the max number of entries in the cache.
|
void |
setResultValueTranslator(ValueTranslator t) |
void |
start()
Starts the component.
|
void |
stop()
Stop the component
|
DynamicJmxOperationService |
withJmxServiceUrl(java.lang.String s) |
DynamicJmxOperationService |
withMaxJmxConnectionCache(java.lang.Integer i) |
DynamicJmxOperationService |
withObjectName(java.lang.String s) |
DynamicJmxOperationService |
withOperationName(java.lang.String s) |
DynamicJmxOperationService |
withOperationParameters(java.util.List<ValueTranslator> l) |
DynamicJmxOperationService |
withResultValueTranslator(ValueTranslator t) |
getObjectName, getOperationName, getOperationParameters, parametersToArray, parametersToTypeArray, setObjectName, setOperationName, setOperationParameters
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, setUniqueId
public static final int DEFAULT_MAX_CACHE_SIZE
public void doService(AdaptrisMessage msg) throws ServiceException
Service
Apply the service to the message.
msg
- the AdaptrisMessage
to processServiceException
- wrapping any underlying Exception
spublic void prepare() throws CoreException
ComponentLifecycleExtension
CoreException
protected void initService() throws CoreException
initService
in class JmxOperationImpl
CoreException
protected void closeService()
closeService
in class ServiceImp
public void stop()
ComponentLifecycle
A stopped component is not expected to be ready to process messages. In the case of AdaptrisMessageConsumer
, calling stop
will pause message delivery. Throwing a RuntimeException
may cause unintended consequences
stop
in interface ComponentLifecycle
stop
in class ServiceImp
public void start() throws CoreException
ComponentLifecycle
Once a component is started it should be ready to process messages. In the case of AdaptrisMessageConsumer
, calling start
will begin message delivery.
start
in interface ComponentLifecycle
start
in class ServiceImp
CoreException
- wrapping any underlying Exception
spublic java.lang.String getJmxServiceUrl()
public void setJmxServiceUrl(java.lang.String s)
s
- the jmxservice url.public ValueTranslator getResultValueTranslator()
public void setResultValueTranslator(ValueTranslator t)
public java.lang.Integer getMaxJmxConnectionCache()
public void setMaxJmxConnectionCache(java.lang.Integer maxSize)
Entries will be removed on a least recently accessed basis.
maxSize
- the maximum number of entries, default is 16public DynamicJmxOperationService withResultValueTranslator(ValueTranslator t)
public DynamicJmxOperationService withJmxServiceUrl(java.lang.String s)
public DynamicJmxOperationService withMaxJmxConnectionCache(java.lang.Integer i)
public DynamicJmxOperationService withOperationName(java.lang.String s)
public DynamicJmxOperationService withObjectName(java.lang.String s)
public DynamicJmxOperationService withOperationParameters(java.util.List<ValueTranslator> l)