Please note that this documentation is not final and is subject to change.

Java™ Platform
Standard Ed. 7

DRAFT ea-b76

javax.management.event
Class FetchingEventForwarder

java.lang.Object
  extended by javax.management.event.FetchingEventForwarder
All Implemented Interfaces:
EventForwarder

public class FetchingEventForwarder
extends Object
implements EventForwarder

This class is used by FetchingEventRelay. When FetchingEventRelay calls EventClientDelegateMBean.addClient(String, Object[], String[]) to get a new client identifier, it uses this class name as the first argument to ask EventClientDelegateMBean to create an object of this class. Then EventClientDelegateMBean forwards client notifications to this object. When FetchingEventRelay calls EventClientDelegateMBean.fetchNotifications(String, long, int, long) to fetch notifications, the EventClientDelegateMBean will forward the call to this object.


Constructor Summary
Constructor and Description
FetchingEventForwarder(int bufferSize)
          Construct a new FetchingEventForwarder with the given buffer size.
 
Method Summary
Modifier and Type Method and Description
 void close()
          Informs the EventForwarder to shut down.
 NotificationResult fetchNotifications(long startSequenceNumber, int maxNotifs, long timeout)
          Called by an EventClientDelegateMBean to forward a user call EventClientDelegateMBean.fetchNotifications(String, long, int, long).
 void forward(Notification n, Integer listenerId)
          Forwards a notification.
 void setClientId(String clientId)
          Sets an event client identifier created by EventClientDelegateMBean.
protected  void setList(List<TargetedNotification> list)
          Sets a user specific list to save notifications in server side before forwarding to an FetchingEventRelay in client side.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchingEventForwarder

public FetchingEventForwarder(int bufferSize)
Construct a new FetchingEventForwarder with the given buffer size.

Parameters:
bufferSize - the size of the buffer that will store notifications until they have been fetched and acknowledged by the client.
Method Detail

fetchNotifications

public NotificationResult fetchNotifications(long startSequenceNumber,
                                             int maxNotifs,
                                             long timeout)
Called by an EventClientDelegateMBean to forward a user call EventClientDelegateMBean.fetchNotifications(String, long, int, long). A call of this method is considered to acknowledge reception of all notifications whose sequence numbers are less the startSequenceNumber, so all these notifications can be deleted from this object.

Parameters:
startSequenceNumber - The first sequence number to consider.
timeout - The maximum waiting time in milliseconds. If no notifications have arrived after this period of time, the call will return with an empty list of notifications.
maxNotifs - The maximum number of notifications to return.

forward

public void forward(Notification n,
                    Integer listenerId)
             throws IOException
Forwards a notification. In this implementation, the notification is stored in the local buffer waiting for fetchNotifications to pick it up.

Specified by:
forward in interface EventForwarder
Parameters:
n - The notification to be forwarded to a remote listener.
listenerId - The identifier of the listener to receive the notification.
Throws:
IOException - If it is closed or an I/O error occurs.

close

public void close()
           throws IOException
Description copied from interface: EventForwarder
Informs the EventForwarder to shut down.

After this method is called, any call to the method forward(Notification, Integer) may get an IOException.

Specified by:
close in interface EventForwarder
Throws:
IOException - If an I/O error occurs.

setClientId

public void setClientId(String clientId)
                 throws IOException
Description copied from interface: EventForwarder
Sets an event client identifier created by EventClientDelegateMBean.

This method will be called just after this EventForwarder is constructed and before calling the forward method to forward any notifications.

Specified by:
setClientId in interface EventForwarder
Throws:
IOException

setList

protected void setList(List<TargetedNotification> list)
Sets a user specific list to save notifications in server side before forwarding to an FetchingEventRelay in client side.

This method should be called before any notification is forwarded to this forwader.

Parameters:
list - a user specific list to save notifications

Java™ Platform
Standard Ed. 7

DRAFT ea-b76

Submit a bug or feature

Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.