Package org.oddjob.jmx.general
Class RemoteBridge
java.lang.Object
org.oddjob.jmx.general.RemoteBridge
- All Implemented Interfaces:
AutoCloseable,RemoteConnection,RemoteInvoker,RemoteNotifier
Bridge between the Oddjob Generic Remote API and JMX remoting.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> voidaddNotificationListener(long remoteId, NotificationType<T> notificationType, NotificationListener<T> notificationListener) voidclose()static NotificationFiltercreateTypeFilterFor(NotificationType<?> type) Create a JMX filter for Notification Type.voiddestroy(long remoteId) Allows an implementations to clear up resources after a node has been destroyed.<T> Tinvoke(long remoteId, OperationType<T> operationType, Object... args) static booleanisFilterForType(NotificationFilter filter, NotificationType<?> notificationType) Is a Filter for a given type.<T> voidremoveNotificationListener(long remoteId, NotificationType<T> notificationType, NotificationListener<T> notificationListener) static <T> NotificationListenertoJmxListener(long remoteId, NotificationListener<T> remoteListener, Class<T> dataType) Convert a Remote listener to an JMX Listener.static NotificationtoJmxNotification(ObjectName objectName, Notification<?> notification) Convert a Remote Notification into a JMX Notification.static MBeanNotificationInfotoMBeanNotification(NotificationType<?> notificationType) Convert anNotificationTypetoMBeanNotificationInfo.static <T> NotificationListener<T> toRemoteListener(ObjectName objectName, NotificationListener jmxListener) Convert an JMX Listener to a Remote Listener.static <T> Notification<T> toRemoteNotification(long remoteId, Class<T> dataType, Notification notification) Convert a JMX Notification into a Remote Notification.
-
Constructor Details
-
RemoteBridge
-
-
Method Details
-
addNotificationListener
public <T> void addNotificationListener(long remoteId, NotificationType<T> notificationType, NotificationListener<T> notificationListener) throws RemoteException - Specified by:
addNotificationListenerin interfaceRemoteNotifier- Throws:
RemoteException
-
removeNotificationListener
public <T> void removeNotificationListener(long remoteId, NotificationType<T> notificationType, NotificationListener<T> notificationListener) throws RemoteException - Specified by:
removeNotificationListenerin interfaceRemoteNotifier- Throws:
RemoteException
-
invoke
public <T> T invoke(long remoteId, OperationType<T> operationType, Object... args) throws RemoteException - Specified by:
invokein interfaceRemoteInvoker- Throws:
RemoteException
-
destroy
Description copied from interface:RemoteConnectionAllows an implementations to clear up resources after a node has been destroyed.- Specified by:
destroyin interfaceRemoteConnection- Parameters:
remoteId- The remote id of the node destroyed.- Throws:
RemoteException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRemoteConnection- Throws:
RemoteException
-
createTypeFilterFor
Create a JMX filter for Notification Type.- Parameters:
type- Notification Type.- Returns:
- The Filter.
- See Also:
-
toRemoteNotification
public static <T> Notification<T> toRemoteNotification(long remoteId, Class<T> dataType, Notification notification) Convert a JMX Notification into a Remote Notification.- Type Parameters:
T- The type of the Notification.- Parameters:
remoteId- The Remote id this is a Notification for.dataType- The type of the Notification.notification- The Notification.- Returns:
- A Remote Notification.
-
toJmxNotification
Convert a Remote Notification into a JMX Notification.- Parameters:
objectName- The Object Name this is a Notification for.notification- The Remote Notification.- Returns:
- An JMX Notification.
-
toRemoteListener
public static <T> NotificationListener<T> toRemoteListener(ObjectName objectName, NotificationListener jmxListener) Convert an JMX Listener to a Remote Listener. This will take a shortcut if the JMX Listener is anRemoteBridge.JmxListenerAdaptor.- Type Parameters:
T- The type of the Notification.- Parameters:
objectName- The object name the JMX Listener is for.jmxListener- The JMX Listener- Returns:
- A Remote Listener.
-
toJmxListener
public static <T> NotificationListener toJmxListener(long remoteId, NotificationListener<T> remoteListener, Class<T> dataType) Convert a Remote listener to an JMX Listener. This will take a shortcut if the Remote Listener is anRemoteBridge.RemoteListenerAdaptor.- Type Parameters:
T- The type The Notification Type.- Parameters:
remoteId- The id this remote listener is for.remoteListener- The Remote Listener.dataType- The class name of the Notification type.- Returns:
- An JMX Listener.
-
isFilterForType
public static boolean isFilterForType(NotificationFilter filter, NotificationType<?> notificationType) Is a Filter for a given type. Provides a shortcut if the Filter is anRemoteBridge.FilterAdaptor.- Parameters:
filter- The filter.notificationType- The Notification Type.- Returns:
- True if it is, false otherwise.
-
toMBeanNotification
Convert anNotificationTypetoMBeanNotificationInfo.- Parameters:
notificationType- The notification type.- Returns:
- The MBean Notification Info
-