mx4j.remote

Class AbstractRemoteNotificationClientHandler

public abstract class AbstractRemoteNotificationClientHandler extends Object implements RemoteNotificationClientHandler

Base implementation of the RemoteNotificationClientHandler interface.

Version: $Revision: 1.7 $

Constructor Summary
protected AbstractRemoteNotificationClientHandler(ConnectionNotificationEmitter emitter, HeartBeat heartbeat, Map environment)
Creates a new remote notification client-side handler.
Method Summary
voidaddNotificationListener(Integer id, NotificationTuple tuple)
booleancontains(NotificationTuple tuple)
protected abstract NotificationResultfetchNotifications(long sequence, int maxNumber, long timeout)
Calls the server side to fetch notifications.
protected LoggergetLogger()
protected intgetMaxRetries()
Returns the maximum number of attempts that should be made before declaring a connection failed.
IntegergetNotificationListener(NotificationTuple tuple)
Integer[]getNotificationListeners(NotificationTuple tuple)
protected intgetNotificationsCount()
protected longgetRetryPeriod()
Returns the period between two retries if the connection with the server side fails.
booleanisActive()
Returns whether this client handler is fetching notifications or not.
voidremoveNotificationListeners(Integer[] ids)
protected voidsendConnectionNotificationLost(long number)
Sends the javax.management.remote.JMXConnectionNotification#NOTIFS_LOST notification using the emitter passed to
voidstart()
voidstop()

Constructor Detail

AbstractRemoteNotificationClientHandler

protected AbstractRemoteNotificationClientHandler(ConnectionNotificationEmitter emitter, HeartBeat heartbeat, Map environment)
Creates a new remote notification client-side handler. It uses an emitter, an heartbeat and an environment to perform the job. All 3 can be null, but the corrispondent methods must be overridden

Parameters: emitter The NotificationEmitter that emits connection failures notifications heartbeat The heart beat is used to get the retry parameters in case of connection failure environment Contains environment variables used to configure this handler

See Also: FETCH_NOTIFICATIONS_MAX_NUMBER FETCH_NOTIFICATIONS_SLEEP FETCH_NOTIFICATIONS_TIMEOUT AbstractRemoteNotificationClientHandler AbstractRemoteNotificationClientHandler AbstractRemoteNotificationClientHandler

Method Detail

addNotificationListener

public void addNotificationListener(Integer id, NotificationTuple tuple)

contains

public boolean contains(NotificationTuple tuple)

fetchNotifications

protected abstract NotificationResult fetchNotifications(long sequence, int maxNumber, long timeout)
Calls the server side to fetch notifications.

getLogger

protected Logger getLogger()

getMaxRetries

protected int getMaxRetries()
Returns the maximum number of attempts that should be made before declaring a connection failed. This implementation returns the heartbeat max retries, but can be overridden.

See Also: AbstractRemoteNotificationClientHandler AbstractRemoteNotificationClientHandler

getNotificationListener

public Integer getNotificationListener(NotificationTuple tuple)

getNotificationListeners

public Integer[] getNotificationListeners(NotificationTuple tuple)

getNotificationsCount

protected int getNotificationsCount()

getRetryPeriod

protected long getRetryPeriod()
Returns the period between two retries if the connection with the server side fails. This implementation returns the heartbeat pulse period, but can be overridden.

See Also: AbstractRemoteNotificationClientHandler AbstractRemoteNotificationClientHandler

isActive

public boolean isActive()
Returns whether this client handler is fetching notifications or not.

See Also: AbstractRemoteNotificationClientHandler AbstractRemoteNotificationClientHandler

removeNotificationListeners

public void removeNotificationListeners(Integer[] ids)

sendConnectionNotificationLost

protected void sendConnectionNotificationLost(long number)
Sends the javax.management.remote.JMXConnectionNotification#NOTIFS_LOST notification using the emitter passed to AbstractRemoteNotificationClientHandler

start

public void start()

stop

public void stop()
Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.