public class ManagerEventListenerProxy extends Object implements ManagerEventListener
Use this proxy to prevent the reader thread from being blocked while your
application processes ManagerEvents.
If you want to use the ManagerConnection for
sending actions in your ManagerEventListener
using a proxy like this one is mandatory; otherwise you will always run into
a timeout because the reader thread that is supposed to read the response to
your action is still blocked processing the event.
If in doubt use the proxy as it won't hurt.
Example:
ManagerConnection connection; ManagerEventListener myListener; ... connection.addEventListener(new ManagerEventListenerProxy(myListener));
| Constructor and Description |
|---|
ManagerEventListenerProxy()
Creates a new ManagerEventListenerProxy.
|
ManagerEventListenerProxy(ManagerEventListener target)
Creates a new ManagerEventListenerProxy that notifies the given target
asynchronously when new events are received.
|
| Modifier and Type | Method and Description |
|---|---|
void |
onManagerEvent(ManagerEvent event)
This method is called when an event is received.
|
void |
setTarget(ManagerEventListener target)
Sets the target listener that is notified asynchronously when new events
are received.
|
void |
shutdown() |
public ManagerEventListenerProxy()
You must set the target by calling setTarget(ManagerEventListener).
public ManagerEventListenerProxy(ManagerEventListener target)
target - the target listener to invoke.public void setTarget(ManagerEventListener target)
target - the target listener to invoke.public void onManagerEvent(ManagerEvent event)
ManagerEventListeneronManagerEvent in interface ManagerEventListenerevent - the event that has been receivedpublic void shutdown()
Copyright © 2004-2012 Stefan Reuter. All Rights Reserved.