public abstract class AbstractRemoteNotificationClientHandler extends java.lang.Object implements RemoteNotificationClientHandler
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRemoteNotificationClientHandler(ConnectionNotificationEmitter emitter,
HeartBeat heartbeat,
java.util.Map environment)
Creates a new remote notification client-side handler.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNotificationListener(java.lang.Integer id,
NotificationTuple tuple)
Adds the given tuple with the given listener ID to this handler
|
boolean |
contains(NotificationTuple tuple)
Returns whether the tuple is already present in this handler
|
protected abstract javax.management.remote.NotificationResult |
fetchNotifications(long sequence,
int maxNumber,
long timeout)
Calls the server side to fetch notifications.
|
protected Logger |
getLogger() |
protected int |
getMaxRetries()
Returns the maximum number of attempts that should be made before declaring a connection
failed.
|
java.lang.Integer |
getNotificationListener(NotificationTuple tuple)
Returns the ID of the listener for the given tuple
|
java.lang.Integer[] |
getNotificationListeners(NotificationTuple tuple)
Returns the IDs of the listeners for the given tuple
|
protected int |
getNotificationsCount() |
protected long |
getRetryPeriod()
Returns the period between two retries if the connection with the server side fails.
|
boolean |
isActive()
Returns whether this client handler is fetching notifications or not.
|
void |
removeNotificationListeners(java.lang.Integer[] ids)
Removes the listeners with the given IDs from this handler
|
protected void |
sendConnectionNotificationLost(long number)
Sends the
JMXConnectionNotification.NOTIFS_LOST notification
using the emitter passed to AbstractRemoteNotificationClientHandler |
void |
start()
Starts notification fetching
|
void |
stop()
Stops notification fetching
|
protected AbstractRemoteNotificationClientHandler(ConnectionNotificationEmitter emitter, HeartBeat heartbeat, java.util.Map environment)
emitter - The NotificationEmitter that emits connection failures notificationsheartbeat - The heart beat is used to get the retry parameters in case of connection failureenvironment - Contains environment variables used to configure this handlerMX4JRemoteConstants.FETCH_NOTIFICATIONS_MAX_NUMBER,
MX4JRemoteConstants.FETCH_NOTIFICATIONS_SLEEP,
MX4JRemoteConstants.FETCH_NOTIFICATIONS_TIMEOUT,
sendConnectionNotificationLost(long),
getMaxRetries(),
getRetryPeriod()public boolean isActive()
public void start()
RemoteNotificationClientHandlerstart in interface RemoteNotificationClientHandlerRemoteNotificationClientHandler.stop()public void stop()
RemoteNotificationClientHandlerstop in interface RemoteNotificationClientHandlerRemoteNotificationClientHandler.start()public boolean contains(NotificationTuple tuple)
RemoteNotificationClientHandlercontains in interface RemoteNotificationClientHandlerpublic void addNotificationListener(java.lang.Integer id,
NotificationTuple tuple)
RemoteNotificationClientHandleraddNotificationListener in interface RemoteNotificationClientHandlerMBeanServerConnection.addNotificationListener(javax.management.ObjectName, javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object),
RemoteNotificationClientHandler.removeNotificationListeners(java.lang.Integer[])public java.lang.Integer[] getNotificationListeners(NotificationTuple tuple)
RemoteNotificationClientHandlergetNotificationListeners in interface RemoteNotificationClientHandlerMBeanServerConnection.removeNotificationListener(javax.management.ObjectName, javax.management.NotificationListener),
RemoteNotificationClientHandler.getNotificationListener(mx4j.remote.NotificationTuple)public java.lang.Integer getNotificationListener(NotificationTuple tuple)
RemoteNotificationClientHandlergetNotificationListener in interface RemoteNotificationClientHandlerMBeanServerConnection.removeNotificationListener(javax.management.ObjectName, javax.management.NotificationListener, javax.management.NotificationFilter, java.lang.Object),
RemoteNotificationClientHandler.getNotificationListeners(mx4j.remote.NotificationTuple)public void removeNotificationListeners(java.lang.Integer[] ids)
RemoteNotificationClientHandlerprotected abstract javax.management.remote.NotificationResult fetchNotifications(long sequence,
int maxNumber,
long timeout)
throws java.io.IOException
java.io.IOExceptionprotected long getRetryPeriod()
protected int getMaxRetries()
protected void sendConnectionNotificationLost(long number)
JMXConnectionNotification.NOTIFS_LOST notification
using the emitter passed to AbstractRemoteNotificationClientHandlerprotected int getNotificationsCount()
protected Logger getLogger()