com.neeve.emx
Interface IEmxEvent

All Known Subinterfaces:
IEmxAlarmEvent, IEmxNwAcceptReadyEvent, IEmxNwConnectReadyEvent, IEmxNwEvent, IEmxNwReadReadyEvent, IEmxNwWriteReadyEvent, IEmxUserEvent

public interface IEmxEvent

Root interface for all dispatcher events.

This interface serves as the root interface for the various event types dispatched by the dispatcher. See IEmxDispatcher for more information on events and how they relate to the dispatcher.

Event objects are cloenable objects. Therefore, implementations of this and subinterfaces must implement the cloneable interface.

Threading:
EMX events are not safe for concurrent access by multiple threads.

Nested Class Summary
static class IEmxEvent.EventType
          Enumerates the supported event types
 
Field Summary
static byte MAXIMUM_EVENT_PRIORITY
          Specifies the maximum event priority
static byte MINIMUM_EVENT_PRIORITY
          Specifies the minimum event priority
static byte NORMAL_EVENT_PRIORITY
          Specifies the default event priority
 
Method Summary
 Object getAttachment()
          Get a user attachment.
 IEmxDispatcher getDispatcher()
          Get the event dispatcher.
 IEmxEventHandler getHandler()
          Get the event handler.
 long getLatency()
          Get the event latency.
 int getPriority()
          Get the event priority.
 IEmxEvent.EventType getType()
          Get the event type.
 IEmxEvent setAttachment(Object attachment)
          Set a user attachment.
 IEmxEvent setHandler(IEmxEventHandler handler)
          Set the event handler.
 IEmxEvent setPriority(int priority)
          Set the event priority.
 

Field Detail

MINIMUM_EVENT_PRIORITY

static final byte MINIMUM_EVENT_PRIORITY
Specifies the minimum event priority

See Also:
Constant Field Values

MAXIMUM_EVENT_PRIORITY

static final byte MAXIMUM_EVENT_PRIORITY
Specifies the maximum event priority

See Also:
Constant Field Values

NORMAL_EVENT_PRIORITY

static final byte NORMAL_EVENT_PRIORITY
Specifies the default event priority

See Also:
Constant Field Values
Method Detail

getType

IEmxEvent.EventType getType()
Get the event type.

Returns:
Returns the event type
Threading:
This method is safe for concurrent access by multiple threads.

setPriority

IEmxEvent setPriority(int priority)
Set the event priority.

Returns:
Returns this object for invocation chaining.
Throws:
IllegalArgumentException - Thrown in case the priority is less than MINIMUM_EVENT_PRIORITY or greater than MAXIMUM_EVENT_PRIORITY.
IllegalStateException - Thrown in case the event is currently being scheduled by a dispatcher. It is illegal to change the priority of an event while it is owned by the dispatcher.
See Also:
getPriority()
Threading:
This method is not safe for concurrent access by multiple threads.

getPriority

int getPriority()
Get the event priority.

Returns:
Returns the event priority
Threading:
This method is safe for concurrent access by multiple threads.

setHandler

IEmxEvent setHandler(IEmxEventHandler handler)
Set the event handler.

Returns:
Returns this object for invocation chaining.
Throws:
IllegalStateException - Thrown in case the event is currently being scheduled by a dispatcher. It is illegal to change the handler of an event while it is owned by the dispatcher.
See Also:
getHandler()
Threading:
This method is not safe for concurrent access by multiple threads.

getHandler

IEmxEventHandler getHandler()
Get the event handler.

Returns:
Returns the handler to which this event will be dispatched.
Threading:
This method is safe for concurrent access by multiple threads.

getDispatcher

IEmxDispatcher getDispatcher()
Get the event dispatcher.

Returns:
Returns the dispatcher that is handling this event.

This method returns the dispatcher that is currently handling this event. The user can use this method to determine whether an event is active with a dispatcher. The dispatcher will reset the attached dispatcher to null before dispatching the event to the user.

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

getLatency

long getLatency()
Get the event latency.

Returns:
Returns an integer containing the time (in nanosecs) between the time event was scheduled and subsequently dispatched.

This method returns the latency of the event in the dispatcher i.e. the time (in nanoseconds) between when the event was scheduled with and subsequently dispatched by the dispatcher.

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

setAttachment

IEmxEvent setAttachment(Object attachment)
Set a user attachment.

Parameters:
attachment - The attachment to set

This method attaches a user object to an event. This object is opaque to the event.

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

getAttachment

Object getAttachment()
Get a user attachment.

Returns:
Returns the attached object.
Threading:
This method is safe for concurrent access by multiple threads.


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