mx4j.remote

Class DefaultRemoteNotificationServerHandler

public class DefaultRemoteNotificationServerHandler extends Object implements RemoteNotificationServerHandler

Base implementation of the RemoteNotificationServerHandler interface.

Version: $Revision: 1.12 $

Constructor Summary
DefaultRemoteNotificationServerHandler(Map environment)
Creates a new remote notification server handler.
Method Summary
voidaddNotificationListener(Integer id, NotificationTuple tuple)
NotificationTuple[]close()
NotificationResultfetchNotifications(long sequenceNumber, int maxNotifications, long timeout)
protected TargetedNotification[]filterNotifications(TargetedNotification[] notifications)
This method filters the given notification array and returns a possibly smaller array containing only notifications that passed successfully the filtering.
IntegergenerateListenerID(ObjectName name, NotificationFilter filter)
protected LoggergetLogger()
NotificationListenergetServerNotificationListener()
NotificationTupleremoveNotificationListener(Integer id)
protected booleanwaitForNotifications(Object lock, long timeout)
Called when there are no notifications to send to the client.

Constructor Detail

DefaultRemoteNotificationServerHandler

public DefaultRemoteNotificationServerHandler(Map environment)
Creates a new remote notification server handler.

Parameters: environment Contains environment variables used to configure this handler

See Also: NOTIFICATION_BUFFER_CAPACITY NOTIFICATION_PURGE_DISTANCE

Method Detail

addNotificationListener

public void addNotificationListener(Integer id, NotificationTuple tuple)

close

public NotificationTuple[] close()

fetchNotifications

public NotificationResult fetchNotifications(long sequenceNumber, int maxNotifications, long timeout)

filterNotifications

protected TargetedNotification[] filterNotifications(TargetedNotification[] notifications)
This method filters the given notification array and returns a possibly smaller array containing only notifications that passed successfully the filtering. Default behavior is no filtering, but subclasses may choose to change this bahavior. For example, for RMI, one can assure that all notifications are truly serializable, and log those that are not.

generateListenerID

public Integer generateListenerID(ObjectName name, NotificationFilter filter)

getLogger

protected Logger getLogger()

getServerNotificationListener

public NotificationListener getServerNotificationListener()

removeNotificationListener

public NotificationTuple removeNotificationListener(Integer id)

waitForNotifications

protected boolean waitForNotifications(Object lock, long timeout)
Called when there are no notifications to send to the client. It is guaranteed that no notification can be added before this method waits on the given lock. It should wait on the given lock for the specified timeout, and return true to send notifications (if no notifications arrived, an empty notification array will be returned to the client), or false if no notifications should be sent to the client.

Parameters: lock The object on which DefaultRemoteNotificationServerHandler should be called timeout The amount of time to wait (guaranteed to be strictly greater than 0)

Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.