|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.asteriskjava.manager.ManagerEventListenerProxy
public class ManagerEventListenerProxy
Proxies a ManagerEventListener and dispatches events asynchronously by using a single threaded executor.
Use this proxy to prevent the reader thread from being blocked while your
application processes ManagerEvent
s.
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 Summary | |
---|---|
ManagerEventListenerProxy()
Creates a new ManagerEventListenerProxy. |
|
ManagerEventListenerProxy(ManagerEventListener target)
Creates a new ManagerEventListenerProxy that notifies the given target asynchronously when new events are received. |
Method Summary | |
---|---|
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()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ManagerEventListenerProxy()
You must set the target by calling setTarget(ManagerEventListener)
.
public ManagerEventListenerProxy(ManagerEventListener target)
target
- the target listener to invoke.Method Detail |
---|
public void setTarget(ManagerEventListener target)
target
- the target listener to invoke.public void onManagerEvent(ManagerEvent event)
ManagerEventListener
onManagerEvent
in interface ManagerEventListener
event
- the event that has been receivedpublic void shutdown()
|
Asterisk-Java | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |