|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpyrasun.eio.Endpoint
Along with EIOEvent, EndpointCoordinator, and EIOGlobalContext, Endpoint is a core
class within EmberIO.
An Endpoint represents an object which can generate EIO I/O events, and typically
are also something that you can directly perform some type of I/O operation upon.
Conceptually, all of these - a socket, a serversocket, an open file, etc - could
be considered Endpoints (but EIO only supports sockets right now). Some people
would think of these as a Connection - but Connection doesn't work well when
you talk about something like a file or shared memory, now does it?
It's called an Endpoint because this represents only one side of an I/O resource -
and presumably there are one or mother processes on the other side.
Endpoints must be constructed with an associated EndpointCoordinator.
The coordinator defines the strategy that will be used to
propogate events related to this Endpoint to the appropriate workers - and also
physically propogates those events.
Note that this sucker is abstract - it's only a conceptual Endpoint. Real physical
Endpoints include ReadWriteEndpoint (think: a socket) and AcceptingEndpoint (think:
a socket server). Future Endpoints might include a FileEndpoint, a SharedMemory
endpoint, and variations on ReadWriteEndpoint like MulticastEndpoint and
maybe even PigeonEndpoint.
Endpoints maintain three sets of event indicators:
| Constructor Summary | |
Endpoint(EndpointCoordinator coordinator)
Constructs a brand new Endpoint associated with the given EndpointCoordinator. |
|
| Method Summary | |
void |
addInterest(EIOEvent event)
Show your interest in a new type of event. |
void |
addProcessing(int what)
|
void |
attach(java.lang.Object obj)
EIO steals the NIO attachment, so we give the poor user a break and let them stick one here. |
java.lang.Object |
attachment()
EIO steals the NIO attachment, so we give the poor user a break and let them stick one here. |
void |
close()
|
void |
close(EIOReasonCode reason)
|
void |
close(EIOReasonCode reason,
java.lang.String msg)
|
void |
close(EIOReasonCode reason,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
|
void |
close(EIOReasonCode reason,
java.lang.Throwable t)
|
void |
configureBlocking(boolean doBlocking)
|
java.lang.String |
dumpProcessedStats(java.lang.String prefix)
|
EIOGlobalContext |
getContext()
Retrieve the global context this guy is running within |
EndpointCoordinator |
getCoordinator()
Get the coordinator associated with this Endpoint. |
int |
getInterestEvents()
Get the events we're interested in in bitmask form. |
abstract java.nio.channels.SelectableChannel |
getNIOChannel()
Get the NIO channel associated with this endpoint. |
int |
getNIOInterestEvents()
Get _only_ the NIO-selectable events we're interested in in bitmask form. |
int |
getProcessingEvents()
Return the events that are currently being processed against this endpoint, in bitmask form. |
int |
getReadyEvents()
Get the events that have fired as "ready" against this endpoint. |
EPStatus |
getState()
Returns the current state of the Endpoint. |
boolean |
isAborted(EIOEvent event)
HACK HACK HACK |
boolean |
isBlocking()
Returns true if this Endpoint is in blocking mode at the moment. |
boolean |
isLockedForProcessing(int eventIDs)
Returns true if any of the specified event flags are locked for processing, false otherwise |
boolean |
isLockedReady(int events)
Returns true if any of the specified flags are locked as "ready". |
boolean |
isOpen()
Returns true if this endpoint is alive and well, false if it got whacked. |
boolean |
isReady(EIOEvent event)
|
boolean |
isSelectorized()
Returns true if the NIO selector owns this Endpoint's ass. |
boolean |
lockForEventManager()
Tries to atomically switch the endpoint over to a WAITING state for injection into the EventManager. |
boolean |
lockForProcessing(EIOEvent event)
Tries to lock down an event for processing. |
boolean |
lockForReady(java.nio.channels.SelectionKey readyStates)
Attempt to lock a new event or set of events as "ready". |
java.lang.String |
masksAsString()
|
void |
registerEventListener(EndpointEventListener listener)
Register an event listener against this Endpoint. |
void |
removeInterest(EIOEvent event)
|
void |
removeProcessing(int what)
|
void |
removeReadiness(int event)
|
void |
reportReadError(EIOReasonCode why,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
|
void |
reportWriteError(EIOReasonCode why,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
|
void |
setName(java.lang.String name)
Set a name for this endpoint which is meaningful to the application - useful for logging and debugging. |
void |
setReadiness(int events)
|
void |
setReadiness(java.nio.channels.SelectionKey readiKey)
|
java.lang.String |
toString()
|
void |
unlockProcessing(EIOEvent event)
Unlocks an event from processing. |
void |
updateProcessedStats(EIOEvent event,
int numOps)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Endpoint(EndpointCoordinator coordinator)
| Method Detail |
public void updateProcessedStats(EIOEvent event,
int numOps)
public java.lang.String dumpProcessedStats(java.lang.String prefix)
public EIOGlobalContext getContext()
public java.lang.Object attachment()
public void attach(java.lang.Object obj)
public EndpointCoordinator getCoordinator()
public abstract java.nio.channels.SelectableChannel getNIOChannel()
public void configureBlocking(boolean doBlocking)
public boolean isBlocking()
public void setName(java.lang.String name)
public void addInterest(EIOEvent event)
public void removeInterest(EIOEvent event)
public int getInterestEvents()
public int getNIOInterestEvents()
public void setReadiness(java.nio.channels.SelectionKey readiKey)
public void setReadiness(int events)
public void removeReadiness(int event)
public boolean isReady(EIOEvent event)
public int getReadyEvents()
public void addProcessing(int what)
public void removeProcessing(int what)
public int getProcessingEvents()
public boolean lockForReady(java.nio.channels.SelectionKey readyStates)
public boolean lockForProcessing(EIOEvent event)
public void unlockProcessing(EIOEvent event)
public boolean lockForEventManager()
public boolean isLockedForProcessing(int eventIDs)
public boolean isLockedReady(int events)
public java.lang.String masksAsString()
public void registerEventListener(EndpointEventListener listener)
public boolean isOpen()
public boolean isSelectorized()
public EPStatus getState()
public boolean isAborted(EIOEvent event)
public void close()
public void close(EIOReasonCode reason)
public void close(EIOReasonCode reason,
java.lang.Throwable t)
public void close(EIOReasonCode reason,
java.lang.String msg)
public void close(EIOReasonCode reason,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
public void reportReadError(EIOReasonCode why,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
public void reportWriteError(EIOReasonCode why,
java.lang.String msg,
java.lang.Throwable t,
java.lang.Object context)
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||