public abstract class AbstractMBeanServerExecutor extends Object implements MBeanServerExecutor, NotificationListener
MBeanServerExecutor.MBeanAction<R>, MBeanServerExecutor.MBeanEachCallback
Constructor and Description |
---|
AbstractMBeanServerExecutor() |
Modifier and Type | Method and Description |
---|---|
<T> T |
call(ObjectName pObjectName,
MBeanServerExecutor.MBeanAction<T> pMBeanAction,
Object... pExtraArgs)
Call an action an the first MBeanServer on which the action does not throw an InstanceNotFoundException
will considered to be successful and this method returns with the return value of the succesful
action.
|
void |
each(ObjectName pObjectName,
MBeanServerExecutor.MBeanEachCallback pCallback)
Iterate over all MBeanServers managed and call the handler via a callback.
|
protected MBeanServerConnection |
getJolokiaMBeanServer()
Override this method if you want to provide a Jolokia private MBeanServer.
|
protected abstract Set<MBeanServerConnection> |
getMBeanServers()
Get all MBeanServers
|
void |
handleNotification(Notification pNotification,
Object pHandback) |
boolean |
hasMBeansListChangedSince(long pTimestamp)
Check whether the set of MBeans in all managed MBeanServer has been changed
since the given time.
|
Set<ObjectName> |
queryNames(ObjectName pObjectName)
Query all MBeanServer and return the union of all results
|
protected void |
registerForMBeanNotifications()
Add this executor as listener for MBeanServer notification so that we can update
the local timestamp for when the set of registered MBeans has changed last.
|
void |
unregisterFromMBeanNotifications()
Unregister us as listener from every registered server
|
protected abstract Set<MBeanServerConnection> getMBeanServers()
protected MBeanServerConnection getJolokiaMBeanServer()
public void each(ObjectName pObjectName, MBeanServerExecutor.MBeanEachCallback pCallback) throws IOException, ReflectionException, MBeanException
each
in interface MBeanServerExecutor
pObjectName
- object name to lookup, which can be a pattern in which case a query is performed.pCallback
- the action to be called for each MBean found on every serverIOException
ReflectionException
MBeanException
public <T> T call(ObjectName pObjectName, MBeanServerExecutor.MBeanAction<T> pMBeanAction, Object... pExtraArgs) throws IOException, ReflectionException, MBeanException, AttributeNotFoundException, InstanceNotFoundException
IllegalArgumentException
is raised (containing the last
InstanceNotFoundException
from the last tried server)call
in interface MBeanServerExecutor
T
- type of the return valuepObjectName
- objectname given through to the actionpMBeanAction
- the action to callpExtraArgs
- any extra args given also to the actionIOException
ReflectionException
MBeanException
- if the JMX call causes an issueAttributeNotFoundException
InstanceNotFoundException
public Set<ObjectName> queryNames(ObjectName pObjectName) throws IOException
queryNames
in interface MBeanServerExecutor
pObjectName
- pattern to query for. If null, then all MBean of all MBeanServers are returnedIOException
- if called remotely and an IOError occured.protected void registerForMBeanNotifications()
public void unregisterFromMBeanNotifications()
public void handleNotification(Notification pNotification, Object pHandback)
handleNotification
in interface NotificationListener
public boolean hasMBeansListChangedSince(long pTimestamp)
hasMBeansListChangedSince
in interface MBeanServerExecutor
pTimestamp
- seconds since 1.1.1970Copyright © 2018. All rights reserved.