Package org.jppf.management
Class JMXDriverConnectionWrapper
java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.management.AbstractJMXConnectionWrapper
org.jppf.management.JMXConnectionWrapper
org.jppf.management.JMXDriverConnectionWrapper
- All Implemented Interfaces:
Serializable,AutoCloseable,JPPFAdminMBean,JPPFDriverAdminMBean
public class JMXDriverConnectionWrapper
extends JMXConnectionWrapper
implements JPPFDriverAdminMBean
Driver-specific JMX connection wrapper, implementing a user-friendly interface for the monitoring
and management of a JPPF driver. Note that this class implements the interface
JPPFDriverAdminMBean.- Author:
- Laurent Cohen
- See Also:
-
Field Summary
Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization
stoppedFields inherited from interface org.jppf.management.JPPFDriverAdminMBean
MBEAN_NAME -
Constructor Summary
ConstructorsConstructorDescriptionInitialize a local connection to the MBean server.JMXDriverConnectionWrapper(String host, int port) Initialize a plain (non-secure) connection to the remote MBean server.JMXDriverConnectionWrapper(String host, int port, boolean secure) Initialize the connection to the remote MBean server.JMXDriverConnectionWrapper(MBeanServerConnection mbeanServer) Initialize a local connection to the MBean server. -
Method Summary
Modifier and TypeMethodDescriptionvoidCancel the job with the specified id.changeLoadBalancerSettings(String algorithm, Map<Object, Object> parameters) Change the bundle size tuning settings.forwardGetAttribute(NodeSelector selector, String name, String attribute) Deprecated.forwardInvoke(NodeSelector selector, String name, String methodName) Deprecated.forwardInvoke(NodeSelector selector, String name, String methodName, Object[] params, String[] signature) Deprecated.forwardSetAttribute(NodeSelector selector, String name, String attribute, Object value) Deprecated.getActiveState(NodeSelector selector) Get the active states of the nodes specified vith aNodeSelector.booleanDetermine whether the driver is broadcasting or not.Get a proxy to the diagnostics/JVM health MBean.This convenience method creates a proxy to the driver's mbean which forwards requests to its nodes.Get a proxy to the dependency manager MBean in the driver.getJobInformation(String jobId) Get an object describing the job with the specified id.This convenience method creates a proxy to the driver's mbean which manages and monitors jobs.This convenience method creates a proxy to the driver's mbean that manages the load-balancers persisted states.<E extends AbstractMBeanForwarder>
EgetMBeanForwarder(Class<?> mbeanInterface) Create a forwarding proxy for the specified node MBean.Deprecated.usegetForwarder()instead.getNodeInformation(String jobId) Get a list of objects describing the nodes to which the whole or part of a job was dispatched.This convenience method creates a proxy to the driver's mbean which manages persisted jobs.Request the JMX connection information for all the idle nodes attached to the server.idleNodesInformation(NodeSelector selector) Request the JMX connection information for all the idle nodes attached to the server which satisfy the specified selector.Obtain the current load-balancing settings.Get the number of nodes currently idle.nbIdleNodes(NodeSelector selector) Get the number of idle nodes attached to the driver that satisfy the specified selector.nbIdleNodes(NodeSelector selector, boolean includePeers) Get the number of idle nodes attached to the driver that satisfy the specified selector.nbNodes()Get the number of nodes attached to the driver.nbNodes(NodeSelector selector) Get the number of nodes attached to the driver that satisfy the specified selector.Request the JMX connection information for all the nodes attached to the server.nodesInformation(NodeSelector selector) Request the JMX connection information for all the nodes attached to the server which satisfy the specified selector.nodesInformation(NodeSelector selector, boolean includePeers) Request the JMX connection information for all the nodes attached to the server which satisfy the specified selector.registerForwardingNotificationListener(NodeSelector selector, String mBeanName, NotificationListener listener, NotificationFilter filter, Object handback) Register a notification listener which will receive notifications from the specified MBean on the selected nodes.voidReset this server's statistics.restartShutdown(Long shutdownDelay, Long restartDelay) Perform a shutdown or restart of the server.voidResume the job with the specified id.voidsetActiveState(NodeSelector selector, boolean active) Set the active state of the specified nodes.voidsetBroadcasting(boolean broadcasting) Activate or deactivate the broadcasting of the driver's connection information.Get the latest statistics snapshot from the JPPF driver.voidsuspendJob(String jobId, Boolean requeue) Suspend the job with the specified id.Get detailed information about the node's JVM properties, environment variables and runtime information such as memory usage and available processors.voidtoggleActiveState(NodeSelector selector) Toggle the activate state of the specified nodes.Uneregister all previously registered forwarding notification listener.voidunregisterForwardingNotificationListener(String listenerID) Unregister a previously registered forwarding notification listeners.voidupdateJobPriority(String jobId, Integer newPriority) Update the priority of a job.voidupdateMaxNodes(String jobId, Integer maxNodes) Update the maximum number of nodes a node can run on.Methods inherited from class org.jppf.management.JMXConnectionWrapper
addJMXConnectionWrapperListener, addNotificationListener, addNotificationListener, close, connect, connectAndWait, getAttribute, getHost, getJmxconnector, getMbeanConnection, getNotificationInfo, getPort, getProxy, getProxy, getURL, invoke, invoke, isConnected, isSecure, removeJMXConnectionWrapperListener, removeNotificationListener, removeNotificationListener, setAttributeMethods inherited from class org.jppf.management.AbstractJMXConnectionWrapper
getDisplayName, getId, getLastConnectionException, getProtocol, isReconnectOnError, setReconnectOnError, toStringMethods inherited from class org.jppf.utils.concurrent.ThreadSynchronization
goToSleep, goToSleep, goToSleep, isStopped, setStopped, wakeUp
-
Constructor Details
-
JMXDriverConnectionWrapper
public JMXDriverConnectionWrapper()Initialize a local connection to the MBean server. -
JMXDriverConnectionWrapper
Initialize a local connection to the MBean server.- Parameters:
mbeanServer- a connection to the mbean server to use.
-
JMXDriverConnectionWrapper
Initialize a plain (non-secure) connection to the remote MBean server.- Parameters:
host- the host the server is running on.port- the port used by the server.
-
JMXDriverConnectionWrapper
Initialize the connection to the remote MBean server.- Parameters:
host- the host the server is running on.port- the port used by the server.secure- specifies whether the connection should be established over SSL/TLS.
-
-
Method Details
-
nbNodes
Description copied from interface:JPPFDriverAdminMBeanGet the number of nodes attached to the driver. Note that this method is equivalent to callingnbNodes(null).- Specified by:
nbNodesin interfaceJPPFDriverAdminMBean- Returns:
- the number of nodes, or -1 if information on the nodes could not be retrieved. The returned number does not include peer drivers.
- Throws:
Exception- if any error occurs.
-
nbNodes
Description copied from interface:JPPFDriverAdminMBeanGet the number of nodes attached to the driver that satisfy the specified selector.- Specified by:
nbNodesin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes shouyld be counted. If null, thenNodeSelector.ALL_NODESwill be used.- Returns:
- the number of nodes, or -1 if information on the nodes could not be retrieved. The returned number does not include peer drivers.
- Throws:
Exception- if any error occurs.
-
nodesInformation
Description copied from interface:JPPFDriverAdminMBeanRequest the JMX connection information for all the nodes attached to the server. Note that this method is equivalent to callingnodesInformation(null, false).- Specified by:
nodesInformationin interfaceJPPFDriverAdminMBean- Returns:
- a collection of
JPPFManagementInfoinstances, ornullif information on the nodes could not be retrieved. - Throws:
Exception- if any error occurs.
-
nodesInformation
Description copied from interface:JPPFDriverAdminMBeanRequest the JMX connection information for all the nodes attached to the server which satisfy the specified selector. Note that this method is equivalent to callingnodesInformation(selector, false).- Specified by:
nodesInformationin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes shouyld be counted. Ifnull, thenNodeSelector.ALL_NODESwill be used.- Returns:
- a collection of
JPPFManagementInfoinstances, ornullif information on the nodes could not be retrieved. - Throws:
Exception- if any error occurs.
-
nodesInformation
public Collection<JPPFManagementInfo> nodesInformation(NodeSelector selector, boolean includePeers) throws Exception Description copied from interface:JPPFDriverAdminMBeanRequest the JMX connection information for all the nodes attached to the server which satisfy the specified selector.- Specified by:
nodesInformationin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes shouyld be counted. Ifnull, thenNodeSelector.ALL_NODESwill be used.includePeers- whether peer drivers should be counted as nodes and included.- Returns:
- a collection of
JPPFManagementInfoinstances, ornullif information on the nodes could not be retrieved. - Throws:
Exception- if any error occurs.
-
statistics
Description copied from interface:JPPFDriverAdminMBeanGet the latest statistics snapshot from the JPPF driver.- Specified by:
statisticsin interfaceJPPFDriverAdminMBean- Returns:
- a
JPPFStatisticsinstance. - Throws:
Exception- if any error occurs.
-
restartShutdown
Description copied from interface:JPPFDriverAdminMBeanPerform a shutdown or restart of the server.- Specified by:
restartShutdownin interfaceJPPFDriverAdminMBean- Parameters:
shutdownDelay- the delay before shutting down the server, once the command is received.restartDelay- the delay before restarting, once the server is shutdown. If it is < 0, no restart occurs.- Returns:
- an acknowledgement message.
- Throws:
Exception- if any error occurs.
-
changeLoadBalancerSettings
public String changeLoadBalancerSettings(String algorithm, Map<Object, Object> parameters) throws ExceptionDescription copied from interface:JPPFDriverAdminMBeanChange the bundle size tuning settings.- Specified by:
changeLoadBalancerSettingsin interfaceJPPFDriverAdminMBean- Parameters:
algorithm- the name opf the load-balancing algorithm to set.parameters- the algorithm's parameters.- Returns:
- an acknowledgement or error message.
- Throws:
Exception- if an error occurred while updating the settings.
-
loadBalancerInformation
Description copied from interface:JPPFDriverAdminMBeanObtain the current load-balancing settings.- Specified by:
loadBalancerInformationin interfaceJPPFDriverAdminMBean- Returns:
- an instance of
LoadBalancingInformation. - Throws:
Exception- if an error occurred while fetching the settings.
-
cancelJob
Cancel the job with the specified id.- Parameters:
jobId- the id of the job to cancel.- Throws:
Exception- if any error occurs.
-
suspendJob
Suspend the job with the specified id.- Parameters:
jobId- the id of the job to suspend.requeue- true if the sub-jobs running on each node should be canceled and requeued, false if they should be left to execute until completion.- Throws:
Exception- if any error occurs.
-
resumeJob
Resume the job with the specified id.- Parameters:
jobId- the id of the job to resume.- Throws:
Exception- if any error occurs.
-
updateMaxNodes
Update the maximum number of nodes a node can run on.- Parameters:
jobId- the id of the job to update.maxNodes- the new maximum number of nodes for the job.- Throws:
Exception- if any error occurs.
-
updateJobPriority
Update the priority of a job.- Parameters:
jobId- the id of the job to update.newPriority- the new priority of the job.- Throws:
Exception- if any error occurs.
-
getJobInformation
Get an object describing the job with the specified id.- Parameters:
jobId- the id of the job to get information about.- Returns:
- an instance of
JobInformation. - Throws:
Exception- if any error occurs.
-
getNodeInformation
Get a list of objects describing the nodes to which the whole or part of a job was dispatched.- Parameters:
jobId- the id of the job for which to find node information.- Returns:
- an array of
NodeManagementInfo,JobInformationinstances. - Throws:
Exception- if any error occurs.
-
resetStatistics
Description copied from interface:JPPFDriverAdminMBeanReset this server's statistics. This method triggers areset()event via theJPPFDriverStatsManagerinstance.- Specified by:
resetStatisticsin interfaceJPPFDriverAdminMBean- Throws:
Exception- if any error occurs.
-
systemInformation
Description copied from interface:JPPFAdminMBeanGet detailed information about the node's JVM properties, environment variables and runtime information such as memory usage and available processors.- Specified by:
systemInformationin interfaceJPPFAdminMBean- Overrides:
systemInformationin classJMXConnectionWrapper- Returns:
- a
JPPFSystemInformationinstance. - Throws:
Exception- if any error occurs.
-
nbIdleNodes
Description copied from interface:JPPFDriverAdminMBeanGet the number of nodes currently idle. Note that this method is equivalent to callingnbIdleNodes(null).- Specified by:
nbIdleNodesin interfaceJPPFDriverAdminMBean- Returns:
- the number of idle nodes, or -1 if information on the nodes could not be retrieved. The returned number does not include peer drivers.
- Throws:
Exception- if any error occurs.
-
nbIdleNodes
Description copied from interface:JPPFDriverAdminMBeanGet the number of idle nodes attached to the driver that satisfy the specified selector.- Specified by:
nbIdleNodesin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes should be counted. Ifnull, thenNodeSelector.ALL_NODESwill be used.- Returns:
- the number of idle nodes, or -1 if information on the nodes could not be retrieved. The returned number does not include peer drivers.
- Throws:
Exception- if any error occurs.
-
nbIdleNodes
Description copied from interface:JPPFDriverAdminMBeanGet the number of idle nodes attached to the driver that satisfy the specified selector.- Specified by:
nbIdleNodesin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes should be counted. Ifnull, thenNodeSelector.ALL_NODESwill be used.includePeers- whether peer drivers should be counted as nodes and included.- Returns:
- the number of idle nodes, or -1 if information on the nodes could not be retrieved. The returned number does not include peer drivers.
- Throws:
Exception- if any error occurs.
-
idleNodesInformation
Description copied from interface:JPPFDriverAdminMBeanRequest the JMX connection information for all the idle nodes attached to the server. Note that this method is equivalent to callingidleNodesInformation(null).- Specified by:
idleNodesInformationin interfaceJPPFDriverAdminMBean- Returns:
- a collection of
JPPFManagementInfoinstances, ornullif information on the nodes could not be retrieved. - Throws:
Exception- if any error occurs.
-
idleNodesInformation
Description copied from interface:JPPFDriverAdminMBeanRequest the JMX connection information for all the idle nodes attached to the server which satisfy the specified selector.- Specified by:
idleNodesInformationin interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies which nodes shouyld be counted. Ifnull, thenNodeSelector.ALL_NODESwill be used.- Returns:
- a collection of
JPPFManagementInfoinstances, ornullif information on the nodes could not be retrieved. - Throws:
Exception- if any error occurs.
-
toggleActiveState
Description copied from interface:JPPFDriverAdminMBeanToggle the activate state of the specified nodes. Nodes in 'active' state will be deactivated, nodes in 'inactive' state will be activated.- Specified by:
toggleActiveStatein interfaceJPPFDriverAdminMBean- Parameters:
selector- determines which nodes will be activated or deactivated. Ifnull, thenNodeSelector.ALL_NODESwill be used.- Throws:
Exception- if any error occurs.
-
getActiveState
Description copied from interface:JPPFDriverAdminMBeanGet the active states of the nodes specified vith aNodeSelector.- Specified by:
getActiveStatein interfaceJPPFDriverAdminMBean- Parameters:
selector- specifies for which nodes to retrieve the active states. Ifnull, thenNodeSelector.ALL_NODESwill be used.- Returns:
- a mmaping of node uuids to their active state.
- Throws:
Exception- if any error occurs.
-
setActiveState
Description copied from interface:JPPFDriverAdminMBeanSet the active state of the specified nodes.- Specified by:
setActiveStatein interfaceJPPFDriverAdminMBean- Parameters:
selector- determines which nodes will be activated or deactivated. Ifnull, thenNodeSelector.ALL_NODESwill be used.active- specifies the activer state to set on the selected nodes.- Throws:
Exception- if any error occurs.
-
setBroadcasting
Description copied from interface:JPPFDriverAdminMBeanActivate or deactivate the broadcasting of the driver's connection information. if the broadcast is already in the desired state, this method has no effect.- Specified by:
setBroadcastingin interfaceJPPFDriverAdminMBean- Parameters:
broadcasting-trueto activate the broadcast,falseto deactivate it.- Throws:
Exception- if any error occurs.
-
getBroadcasting
Description copied from interface:JPPFDriverAdminMBeanDetermine whether the driver is broadcasting or not.- Specified by:
getBroadcastingin interfaceJPPFDriverAdminMBean- Returns:
trueif the broadcasting service is on,falseif it is off.- Throws:
Exception- if any error occurs.
-
registerForwardingNotificationListener
public String registerForwardingNotificationListener(NodeSelector selector, String mBeanName, NotificationListener listener, NotificationFilter filter, Object handback) throws Exception Register a notification listener which will receive notifications from the specified MBean on the selected nodes.- Parameters:
selector- determines which nodes will be selected.mBeanName- the name of the MBean from which to receive notificaztions from the selected nodes.listener- the listener to register.filter- the notification filter.handback- the handback object.- Returns:
- the id of the registered listener, to use with
unregisterForwardingNotificationListener(String). - Throws:
Exception- if any error occurs.
-
unregisterForwardingNotificationListener
Unregister a previously registered forwarding notification listeners.- Parameters:
listenerID- the id of a listener previously registered withregisterForwardingNotificationListener(NodeSelector,String,NotificationListener,NotificationFilter,Object).- Throws:
Exception- if the listener with this id was not found or if any other error occurss.
-
unregisterAllForwardingNotificationListeners
Uneregister all previously registered forwarding notification listener.- Returns:
- a list of the ids of the listeners that were unregistered, if any. This list may be empty but never
null. - Throws:
Exception- if any error occurs.
-
forwardInvoke
public Map<String,Object> forwardInvoke(NodeSelector selector, String name, String methodName, Object[] params, String[] signature) throws Exception Deprecated.usegetForwarder().forwardInvoke(selector, name, methodName, params, signature)instead. Thsis method always returnsnull.Invoke a method on the specified MBean of all nodes attached to the driver.- Parameters:
selector- a filter on the nodes attached tot he driver, determines the nodes to which this method applies.name- the name of the MBean.methodName- the name of the method to invoke.params- the method parameter values.signature- the types of the method parameters.- Returns:
- a mapping of node uuids to the result of invoking the MBean method on the corresponding node. Each result may be an exception.
Additionally, each result may benull, in particular if the invoked method has avoidreturn type. - Throws:
Exception- if the invocation failed.
-
forwardInvoke
public Map<String,Object> forwardInvoke(NodeSelector selector, String name, String methodName) throws Exception Deprecated.usegetForwarder().forwardInvoke(selector, name, methodName)instead. Thsis method always returnsnull.Convenience method to invoke an MBean method that has no parameter.
This is equivalent to callingforwardInvoke(selector, name, methodName, (Object[]) null, (String[]) null).- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes to which this method applies.name- the name of the node MBean to invoke.methodName- the name of the method to invoke.- Returns:
- a mapping of node uuids to the result of invoking the MBean method on the corresponding node. Each result may be an exception.
Additionally, each result may benull, in particular if the invoked method has avoidreturn type. - Throws:
Exception- if the invocation failed.
-
forwardGetAttribute
public Map<String,Object> forwardGetAttribute(NodeSelector selector, String name, String attribute) throws Exception Deprecated.usegetForwarder().forwardGetAttribute(selector, name, attribute)instead. Thsis method always returnsnull.Get the value of an attribute of the specified MBean for each specified node.- Parameters:
selector- a filter on the nodes attached tot he driver, determines the nodes to which this method applies.name- the name of the MBean to invoke for each node.attribute- the name of the MBean attribute to read.- Returns:
- a mapping of node uuids to the result of getting the MBean attribute on the corresponding node. Each result may be an exception.
- Throws:
Exception- if the invocation failed.
-
forwardSetAttribute
public Map<String,Object> forwardSetAttribute(NodeSelector selector, String name, String attribute, Object value) throws Exception Deprecated.usegetForwarder().forwardSetAttribute(selector, name, attribute, value)instead. Thsis method always returnsnull.Set the value of an attribute of the specified MBean on the specified nodes attached to the driver.- Parameters:
selector- a filter on the nodes attached to the driver, determines the nodes to which this method applies.name- the name of the MBean to invoke for each node.attribute- the name of the MBean attribute to set.value- the value to set on the attribute.- Returns:
- a mapping of node uuids to an eventual exception resulting from setting the MBean attribute on the corresponding node. This map may be empty if no exception was raised.
- Throws:
Exception- if the invocation failed.
-
getForwarder
This convenience method creates a proxy to the driver's mbean which forwards requests to its nodes. It is equivalent to calling the more cumbersomegetProxy(NodeForwardingMBean.MBEAN_NAME, NodeForwardingMBean.class).- Returns:
- an instance of
NodeForwardingMBean. - Throws:
Exception- if a proxy could not be created for any reason.- Since:
- 4.2
-
getNodeForwarder
Deprecated.usegetForwarder()instead. Thsis method always returnsnull.This convenience method creates a proxy to the driver's mbean which forwards requests to its nodes. It is equivalent to calling the more cumbersomegetProxy(JPPFNodeForwardingMBean.MBEAN_NAME, JPPFNodeForwardingMBean.class).- Returns:
- an instance of
JPPFNodeForwardingMBean. - Throws:
Exception- if a proxy could not be created for any reason.- Since:
- 4.2
-
getJobManager
This convenience method creates a proxy to the driver's mbean which manages and monitors jobs. It is equivalent to calling the more cumbersomegetProxy(DriverJobManagementMBean.MBEAN_NAME, DriverJobManagementMBean.class).- Returns:
- an instance of
DriverJobManagementMBean. - Throws:
Exception- if a proxy could not be created for any reason.- Since:
- 4.2
-
getPersistedJobsManager
This convenience method creates a proxy to the driver's mbean which manages persisted jobs. It is equivalent to calling the more cumbersomegetProxy(PersistedJobsManagerMBean.MBEAN_NAME, PersistedJobsManagerMBean.class).- Returns:
- an instance of
PersistedJobsManagerMBean. - Throws:
Exception- if a proxy could not be created for any reason.
-
getLoadBalancerPersistenceManagement
This convenience method creates a proxy to the driver's mbean that manages the load-balancers persisted states. It is equivalent to calling the more cumbersomegetProxy(LoadBalancerPersistenceManagerMBean.MBEAN_NAME, LoadBalancerPersistenceManagerMBean.class).- Returns:
- an instance of
PersistedJobsManagerMBean. - Throws:
Exception- if a proxy could not be created for any reason.- Since:
- 6.0
-
getDiagnosticsProxy
Description copied from class:JMXConnectionWrapperGet a proxy to the diagnostics/JVM health MBean.- Overrides:
getDiagnosticsProxyin classJMXConnectionWrapper- Returns:
- a DiagnosticsMBean instance.
- Throws:
Exception- if any error occurs.
-
getJobDependencyManager
Get a proxy to the dependency manager MBean in the driver. This is a shortcut method forgetProxy(JobDependencyManagerMBean.MBEAN_NAME, JobDependencyManagerMBean.class).- Returns:
- an instance of an implementation of the
JobDependencyManagerMBeaninterface. - Throws:
Exception- if any error occurs.- Since:
- 6.2
-
getMBeanForwarder
public <E extends AbstractMBeanForwarder> E getMBeanForwarder(Class<?> mbeanInterface) throws Exception Create a forwarding proxy for the specified node MBean.- Type Parameters:
E- the type of mbean interface.- Parameters:
mbeanInterface- the class of the node MBean nterface.- Returns:
- a forwarding proxy to the specified MBean.
- Throws:
Exception- if any error occurs.- Since:
- 6.2
-
getForwarder().forwardGetAttribute(selector, name, attribute)instead.