|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bloomberglp.blpapi.EventDispatcher
public final class EventDispatcher
Dispatches events from one or more sessions through callbacks.
EventDispatcher objects are optionally specified when
Session
objects are constructed. A single EventDispatcher can be
shared by multiple Session objects. The EventDispatcher provides an
event-driven interface, generating callbacks from one or more internal
threads for one or more sessions.
Nested Class Summary | |
---|---|
static class |
EventDispatcher.StopOption
Enumerations for controlled shutdown of the EventDispatcher |
Constructor Summary | |
---|---|
EventDispatcher()
Same as calling EventDispatcher(0) |
|
EventDispatcher(int numThreads)
Create an EventDispatcher with the specified number of dispatcher threads |
|
EventDispatcher(int numThreads,
int maxPendingEvents)
Deprecated. As of release 3.1.0.0 use SessionOptions.setMaxEventQueueSize(int) for setting the
event queue size per session |
Method Summary | |
---|---|
void |
dispatcherThread()
Add a event dispatcher thread to this EventDispatcher |
int |
numActiveThreads()
Return the number of active threads dispatching events in this EventDispatcher |
boolean |
start()
Start generating callbacks for events from Sessions associated with this EventDispatcher |
void |
stop()
Same as calling stop(com.bloomberglp.blpapi.EventDispatcher.StopOption) with
EventDispatcher.StopOption.SYNC |
void |
stop(EventDispatcher.StopOption stopOption)
Stop generating callbacks for events from sessions |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventDispatcher() throws java.io.IOException
EventDispatcher(0)
java.io.IOException
public EventDispatcher(int numThreads) throws java.io.IOException
The specified number of threads is >= 1 then a pool of numThreads threads are created to dispatch events. The behavior is undefined if numThreads is zero.
numThreads
- the number of dispatcher threads to create
java.io.IOException
public EventDispatcher(int numThreads, int maxPendingEvents) throws java.io.IOException
SessionOptions.setMaxEventQueueSize(int)
for setting the
event queue size per session
numThreads
- maxPendingEvents
-
java.io.IOException
Method Detail |
---|
public boolean start()
public void stop() throws java.lang.InterruptedException
stop(com.bloomberglp.blpapi.EventDispatcher.StopOption)
with
EventDispatcher.StopOption.SYNC
java.lang.InterruptedException
public void stop(EventDispatcher.StopOption stopOption) throws java.lang.InterruptedException
Stop generating callbacks for events from sessions associated with this
EventDispatcher. If the specified stopOption is EventDispatcher.StopOption.SYNC
then this method blocks until all current callbacks which were dispatched
through this EventDispatcher have completed. If the stopOption is
EventDispatcher.StopOption.ASYNC
then this method returns immediately and no
further callbacks will be dispatched.
stopOption
-
java.lang.InterruptedException
public void dispatcherThread()
By calling this method applications provide a thread to the EventDispatcher for it to use to dispatch events. This call will not return until the EventDispatcher stops dispatching events. The application can call this method multiple times for the same instance of an EventDispatcher to provide a pool of threads.
This method will return immediately if this EventDispatcher has not been started.
public int numActiveThreads()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |