org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote
Class DefaultRemoteNotificationServerHandler

java.lang.Object
  extended by org.apache.felix.mosgi.jmx.rmiconnector.mx4j.remote.DefaultRemoteNotificationServerHandler
All Implemented Interfaces:
RemoteNotificationServerHandler

public class DefaultRemoteNotificationServerHandler
extends java.lang.Object
implements RemoteNotificationServerHandler

Version:
$Revision: 1.1.1.1 $
Author:
Simone Bordet

Nested Class Summary
 class DefaultRemoteNotificationServerHandler.NotificationBuffer
           
 class DefaultRemoteNotificationServerHandler.ServerListener
           
 
Constructor Summary
DefaultRemoteNotificationServerHandler(java.util.Map environment)
           
 
Method Summary
 void addNotificationListener(java.lang.Integer id, NotificationTuple tuple)
           
 javax.management.remote.NotificationResult fetchNotifications(long sequenceNumber, int maxNotifications, long timeout)
           
protected  javax.management.remote.TargetedNotification[] filterNotifications(javax.management.remote.TargetedNotification[] notifications)
          This method filters the given notification array and returns a possibly smaller array containing only notifications that passed successfully the filtering.
 java.lang.Integer generateListenerID(javax.management.ObjectName name, javax.management.NotificationFilter filter)
           
 NotificationTuple getNotificationListener(java.lang.Integer id)
           
 javax.management.NotificationListener getServerNotificationListener()
           
 void removeNotificationListener(java.lang.Integer id)
           
protected  boolean waitForNotifications(java.lang.Object lock, long timeout)
          Called when there are no notifications to send to the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultRemoteNotificationServerHandler

public DefaultRemoteNotificationServerHandler(java.util.Map environment)
Method Detail

generateListenerID

public java.lang.Integer generateListenerID(javax.management.ObjectName name,
                                            javax.management.NotificationFilter filter)
Specified by:
generateListenerID in interface RemoteNotificationServerHandler

getServerNotificationListener

public javax.management.NotificationListener getServerNotificationListener()
Specified by:
getServerNotificationListener in interface RemoteNotificationServerHandler

addNotificationListener

public void addNotificationListener(java.lang.Integer id,
                                    NotificationTuple tuple)
Specified by:
addNotificationListener in interface RemoteNotificationServerHandler

removeNotificationListener

public void removeNotificationListener(java.lang.Integer id)
Specified by:
removeNotificationListener in interface RemoteNotificationServerHandler

getNotificationListener

public NotificationTuple getNotificationListener(java.lang.Integer id)
Specified by:
getNotificationListener in interface RemoteNotificationServerHandler

fetchNotifications

public javax.management.remote.NotificationResult fetchNotifications(long sequenceNumber,
                                                                     int maxNotifications,
                                                                     long timeout)
Specified by:
fetchNotifications in interface RemoteNotificationServerHandler

waitForNotifications

protected boolean waitForNotifications(java.lang.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 Object.wait(long) should be called
timeout - The amount of time to wait (guaranteed to be strictly greater than 0)

filterNotifications

protected javax.management.remote.TargetedNotification[] filterNotifications(javax.management.remote.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.