|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.virtualbox_7_0.IUnknown
org.virtualbox_7_0.IEventSource
public class IEventSource
Event source. Generally, any object which could generate events can be an event source,
or aggregate one. To simplify using one-way protocols such as webservices running on top of HTTP(S),
an event source can work with listeners in either active or passive mode. In active mode it is up to
the IEventSource implementation to callIEventListener.handleEvent(org.virtualbox_7_0.IEvent)
, in passive mode the
event source keeps track of pending events for each listener and returns available events on demand.
SeeIEvent
for an introduction to VirtualBox event handling.
Interface ID: {9B6E1AEE-35F3-4F4D-B5BB-ED0ECEFD8538}
Field Summary |
---|
Fields inherited from class org.virtualbox_7_0.IUnknown |
---|
obj, objMgr, port |
Constructor Summary | |
---|---|
IEventSource(java.lang.String wrapped,
org.virtualbox_7_0.ObjectRefManager objMgr,
org.virtualbox_7_0.jaxws.VboxPortType port)
|
Method Summary | |
---|---|
IEventSource |
createAggregator(java.util.List<IEventSource> subordinates)
Creates an aggregator event source, collecting events from multiple sources. |
IEventListener |
createListener()
Creates a new listener object, useful for passive mode. |
void |
eventProcessed(IEventListener listener,
IEvent event)
Must be called for waitable events after a particular listener finished its event processing. |
java.lang.Boolean |
fireEvent(IEvent event,
java.lang.Integer timeout)
Fire an event for this source. |
IEvent |
getEvent(IEventListener listener,
java.lang.Integer timeout)
Get events from this peer's event queue (for passive mode). |
static IEventSource |
queryInterface(IUnknown obj)
|
void |
registerListener(IEventListener listener,
java.util.List<VBoxEventType> interesting,
java.lang.Boolean active)
Register an event listener. |
void |
unregisterListener(IEventListener listener)
Unregister an event listener. |
Methods inherited from class org.virtualbox_7_0.IUnknown |
---|
getObjMgr, getRemoteWSPort, getWrapped, releaseRemote |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IEventSource(java.lang.String wrapped, org.virtualbox_7_0.ObjectRefManager objMgr, org.virtualbox_7_0.jaxws.VboxPortType port)
Method Detail |
---|
public static IEventSource queryInterface(IUnknown obj)
public IEventListener createListener()
public IEventSource createAggregator(java.util.List<IEventSource> subordinates)
getEvent(org.virtualbox_7_0.IEventListener,Integer)
on the returned aggregator.
subordinates
- Subordinate event source this one aggregates.
public void registerListener(IEventListener listener, java.util.List<VBoxEventType> interesting, java.lang.Boolean active)
listener
- Listener to register.interesting
- Event types listener is interested in. One can use wildcards like -VBoxEventType.Any
to specify wildcards, matching more
than one event.active
- Which mode this listener is operating in.
In active mode,IEventListener.handleEvent(org.virtualbox_7_0.IEvent)
is called directly.
In passive mode, an internal event queue is created for this this IEventListener.
For each event coming in, it is added to queues for all interested registered passive
listeners. It is then up to the external code to call the listener'sIEventListener.handleEvent(org.virtualbox_7_0.IEvent)
method. When done with an event, the
external code must calleventProcessed(org.virtualbox_7_0.IEventListener,org.virtualbox_7_0.IEvent)
.
NOTE: To avoid system overload, the VirtualBox server process checks if passive event
listeners callgetEvent(org.virtualbox_7_0.IEventListener,Integer)
frequently enough. In the
current implementation, if more than 500 pending events are detected for a passive
event listener, it is forcefully unregistered by the system, and furthergetEvent(org.virtualbox_7_0.IEventListener,Integer)
calls will return VBOX_E_OBJECT_NOT_FOUND.public void unregisterListener(IEventListener listener)
listener
- Listener to unregister.public java.lang.Boolean fireEvent(IEvent event, java.lang.Integer timeout)
event
- Event to deliver.timeout
- Maximum time to wait for event processing (if event is waitable), in ms;
0 = no wait, -1 = indefinite wait.
public IEvent getEvent(IEventListener listener, java.lang.Integer timeout)
registerListener(org.virtualbox_7_0.IEventListener,List,Boolean)
for details.
listener
- Which listener to get data for.timeout
- Maximum time to wait for events, in ms;
0 = no wait, -1 = indefinite wait.
VBOX_E_OBJECT_NOT_FOUND | Listener is not registered, or autounregistered. |
public void eventProcessed(IEventListener listener, IEvent event)
IEvent.setProcessed()
.
listener
- Which listener processed event.event
- Which event.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |