|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.management.event.FetchingEventRelay
public class FetchingEventRelay extends Object implements EventRelay
This class is an implementation of the EventRelay interface. It calls
fetchNotifications(String, long, int, long) to get
notifications and then forwards them to an EventReceiver object.
A fetchExecutor parameter can be specified when creating a
FetchingEventRelay. That is then the Executor that will
be used to perform the fetchNotifications operation. Only one
job at a time will be submitted to this Executor. The behavior
is unspecified if Executor.execute(java.lang.Runnable) throws an exception, including
RejectedExecutionException.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size: 1000. |
static int |
DEFAULT_MAX_NOTIFICATIONS
The default maximum notifications to fetch every time: 1000. |
static long |
DEFAULT_WAITING_TIMEOUT
The default waiting timeout: 60000L in millseconds when fetching notifications from an EventClientDelegateMBean. |
| Constructor and Description |
|---|
FetchingEventRelay(EventClientDelegateMBean delegate)
Constructs a default FetchingEventRelay object by using the default
configuration: DEFAULT_BUFFER_SIZE, DEFAULT_WAITING_TIMEOUT
DEFAULT_MAX_NOTIFICATIONS. |
FetchingEventRelay(EventClientDelegateMBean delegate,
Executor fetchExecutor)
Constructs a FetchingEventRelay object by using the default
configuration: DEFAULT_BUFFER_SIZE, DEFAULT_WAITING_TIMEOUT
DEFAULT_MAX_NOTIFICATIONS, with a user-specific executor to do
the fetching. |
FetchingEventRelay(EventClientDelegateMBean delegate,
int bufferSize,
long timeout,
int maxNotifs,
Executor fetchExecutor)
Constructs a FetchingEventRelay object with user-specific
configuration and executor to fetch notifications via the
EventClientDelegateMBean. |
FetchingEventRelay(EventClientDelegateMBean delegate,
int bufferSize,
long timeout,
int maxNotifs,
Executor fetchExecutor,
String forwarderName,
Object[] params,
String[] sig)
Constructs a FetchingEventRelay object with user-specific
configuration and executor to fetch notifications via the
EventClientDelegateMBean. |
| Modifier and Type | Method and Description |
|---|---|
String |
getClientId()
Returns an identifier that is used by this EventRelay to identify
the client when communicating with the EventClientDelegateMBean. |
void |
setEventReceiver(EventReceiver eventReceiver)
This method is called by EventClient to register a callback
to receive notifications from an EventClientDelegateMBean object. |
void |
stop()
Stops receiving and forwarding notifications and performs any necessary cleanup. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_BUFFER_SIZE
public static final long DEFAULT_WAITING_TIMEOUT
EventClientDelegateMBean.
public static final int DEFAULT_MAX_NOTIFICATIONS
| Constructor Detail |
|---|
public FetchingEventRelay(EventClientDelegateMBean delegate)
throws IOException,
MBeanException
FetchingEventRelay object by using the default
configuration: DEFAULT_BUFFER_SIZE, DEFAULT_WAITING_TIMEOUT
DEFAULT_MAX_NOTIFICATIONS. A single thread is created
to do fetching.
delegate - The EventClientDelegateMBean to work with.IOException - If failed to work with the delegate.MBeanException - if unable to add a client to the remote
EventClientDelegateMBean (see EventClientDelegateMBean.addClient).IllegalArgumentException - If delegate is null.
public FetchingEventRelay(EventClientDelegateMBean delegate,
Executor fetchExecutor)
throws IOException,
MBeanException
FetchingEventRelay object by using the default
configuration: DEFAULT_BUFFER_SIZE, DEFAULT_WAITING_TIMEOUT
DEFAULT_MAX_NOTIFICATIONS, with a user-specific executor to do
the fetching.
delegate - The EventClientDelegateMBean to work with.fetchExecutor - Used to do the fetching. A new thread is created if
null.IOException - If failed to work with the delegate.MBeanException - if unable to add a client to the remote
EventClientDelegateMBean (see EventClientDelegateMBean.addClient).IllegalArgumentException - If delegate is null.
public FetchingEventRelay(EventClientDelegateMBean delegate,
int bufferSize,
long timeout,
int maxNotifs,
Executor fetchExecutor)
throws IOException,
MBeanException
FetchingEventRelay object with user-specific
configuration and executor to fetch notifications via the
EventClientDelegateMBean.
delegate - The EventClientDelegateMBean to work with.bufferSize - The buffer size for saving notifications in
EventClientDelegateMBean before they are fetched.timeout - The waiting time in millseconds when fetching
notifications from an EventClientDelegateMBean.maxNotifs - The maximum notifications to fetch every time.fetchExecutor - Used to do the fetching. A new thread is created if
null.IOException - if failed to communicate with the delegate.MBeanException - if unable to add a client to the remote
EventClientDelegateMBean (see EventClientDelegateMBean.addClient).IllegalArgumentException - If delegate is null.
public FetchingEventRelay(EventClientDelegateMBean delegate,
int bufferSize,
long timeout,
int maxNotifs,
Executor fetchExecutor,
String forwarderName,
Object[] params,
String[] sig)
throws IOException,
MBeanException
FetchingEventRelay object with user-specific
configuration and executor to fetch notifications via the
EventClientDelegateMBean.
delegate - The EventClientDelegateMBean to work with.bufferSize - The buffer size for saving notifications in
EventClientDelegateMBean before they are fetched.timeout - The waiting time in millseconds when fetching
notifications from an EventClientDelegateMBean.maxNotifs - The maximum notifications to fetch every time.fetchExecutor - Used to do the fetching.forwarderName - the class name of a user specific EventForwarder
to create in server to forward notifications to this object. The class
should be a subclass of the class FetchingEventForwarder.params - the parameters passed to create forwarderNamesig - the signature of the paramsIOException - if failed to communicate with the delegate.MBeanException - if unable to add a client to the remote
EventClientDelegateMBean (see EventClientDelegateMBean.addClient).IllegalArgumentException - if bufferSize or
maxNotifs is less than 1NullPointerException - if delegate is null.| Method Detail |
|---|
public void setEventReceiver(EventReceiver eventReceiver)
EventRelayEventClient to register a callback
to receive notifications from an EventClientDelegateMBean object.
A null value is allowed, which means that the EventClient suspends
reception of notifications, so that the EventRelay can decide to stop receiving
notifications from its EventForwarder.
setEventReceiver in interface EventRelayeventReceiver - An EventClient callback to receive
events.public String getClientId()
EventRelayEventRelay to identify
the client when communicating with the EventClientDelegateMBean.
This identifier is obtained by calling
EventClientDelegateMBean.addClient.
It is the EventRelay that calls EventClientDelegateMBean to obtain
the client identifier because it is the EventRelay that decides
how to get notifications from the EventClientDelegateMBean,
by creating the appropriate EventForwarder.
getClientId in interface EventRelaypublic void stop()
EventRelayEventClient will never
call any other methods of this object.
stop in interface EventRelayEventClient.close()
|
Java™ Platform Standard Ed. 7 DRAFT ea-b76 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.