com.neeve.event
Interface IEventMultiplexer

All Superinterfaces:
IEventHandler
All Known Implementing Classes:
EventMultiplexer, EventMultiplexerFreeThreadedSerialized, EventMultiplexerPassThrough, EventMultiplexerSingleThreaded

public interface IEventMultiplexer
extends IEventHandler

Represents an event multiplexer.

An event multiplexer is responsible for multiplexing events arriving on the event sources' execution lines (threads) onto a single dispatch execution line (thread).

Threading:
An event multiplexer is safe for concurrent access by multiple threads.

Nested Class Summary
static class IEventMultiplexer.State
          Enumerates a multiplexer state
 
Field Summary
static int NON_BLOCKING
          Flag used with onEvent(Event, int) to indicate that the calling thread cannot be blocked.
 
Method Summary
 void close()
          Close a multiplexer.
 String getName()
          Get an event multiplexer's name.
 IEventMultiplexerStats getStats()
          Get an event multiplexer's statistics object.
 void multiplexEvent(Event event, int flags)
          Multiplex an event into one of the multiplexer's threads.
 void onEvent(Event event, int flags)
          Deprecated. 
 void open()
          Open a multiplexer.
 int scheduledEventCount()
          Get the number of events scheduled for dispatch with a multiplexer
 void scheduleEvent(Event event)
          Schedule an event for dispatch at a later point in time.
 void setAllEventDispatch(boolean val)
          Configure the multiplexer to dispatch all events including internal events This method controls whether the multiplexer dispatches all events, including internal ones, to the user.
 void unscheduleEvent(Event event)
          Unschedule a scheduled event.
 
Methods inherited from interface com.neeve.event.IEventHandler
onEvent
 

Field Detail

NON_BLOCKING

static final int NON_BLOCKING
Flag used with onEvent(Event, int) to indicate that the calling thread cannot be blocked.

See Also:
Constant Field Values
Method Detail

open

void open()
Open a multiplexer.

Threading:
This method is not safe for concurrent access by multiple threads. This method should be invoked once and only once by the user.

This method opens a multiplexer inbound event gates i.e. received events will be returned with exception until this method is invoked successfully.

This method can only be invoked on a multiplexer in the initialized state.


getName

String getName()
Get an event multiplexer's name.


getStats

IEventMultiplexerStats getStats()
Get an event multiplexer's statistics object.


setAllEventDispatch

void setAllEventDispatch(boolean val)
Configure the multiplexer to dispatch all events including internal events

This method controls whether the multiplexer dispatches all events, including internal ones, to the user. Dispatch of all events should be enabled if the user is processing the EOB flag on events.


onEvent

@Deprecated
void onEvent(Event event,
                        int flags)
Deprecated. 

Feed an event for dispatch into the multiplexer dispatch loop.

Parameters:
event - The event to multiplex
flags - Flags that qualify the multiplexing
Threading:
This method is safe for concurrent access by multiple threads with itself or any of the other multiplexer methods.

Note: This method has been deprectaed in favor of the multiplexEvent(com.neeve.event.Event, int)


multiplexEvent

void multiplexEvent(Event event,
                    int flags)
Multiplex an event into one of the multiplexer's threads.

Parameters:
event - The event to multiplex
flags - Flags that qualify the multiplexing
Threading:
This method is safe for concurrent access by multiple threads with itself or any of the other multiplexer methods.

scheduleEvent

void scheduleEvent(Event event)
Schedule an event for dispatch at a later point in time.

Parameters:
event - The event to schedule
Threading:
This method must only be invoked from the multiplexer event handler and by the thread that invoked the handler.

unscheduleEvent

void unscheduleEvent(Event event)
Unschedule a scheduled event.

Parameters:
event - The event to unschedule
Threading:
This method must only be invoked from the multiplexer event handler and by the thread that invoked the handler.

scheduledEventCount

int scheduledEventCount()
Get the number of events scheduled for dispatch with a multiplexer

Threading:
This method is safe for concurrent access by multiple threads with itelf and other methods in the multiplexer.

close

void close()
Close a multiplexer.

Threading:
This method is safe for concurrent access by multiple threads.

This method closes a multiplexer's input gates i.e. upon return from this method, any events fed into the multiplexer will throw an exception and any attempt to schedule an event will fail with an exception.

This method can only be invoked on a multiplexer in any state. Invoking the method in the initialized or closed state is a no-op (except for a state transition to closed).



Copyright © 2016 Neeve Research, LLC. All Rights Reserved.