pyrasun.eio
Class EndpointCoordinator

java.lang.Object
  extended bypyrasun.eio.EndpointCoordinator

public class EndpointCoordinator
extends java.lang.Object

An EndpointCoordinator is used coordinate activity for a given type of endpoint. A bit less cryptically, the EndpointCoordinator receives I/O events from the EIOEventManager for specific endpoints, and routes them to the appropriate workers. It's also the centralized location where a user tells EIO how to handle a given type of Endpoint. If it helps - you could probably change the name of this to EndpointType, to indicate that it represents a specific type or flavor of Endpoint. In fact, it used to be called that. In fact, I really don't know _what_ to call this. I'll send a free copy of the EmberIO source to anyone who comes up with a really effective name!


Constructor Summary
EndpointCoordinator(EIOGlobalContext context, java.lang.String name, EIOWorkerFactory factory, EIOPoolingStrategy strategy)
          Construct a new EndpointCoordinator.
 
Method Summary
 void dumpEndpoints()
          Only here for debugging purposes
 EIOGlobalContext getContext()
          Get the global context associated with this EndpointCoordinator.
 EIOEventDescriptor getEventDescriptor(EIOEvent event)
          Return an event descriptor that defines this coordinator's pooling strategy for a given event.
 EIOEventManager getEventManager()
          Get the event manager associated with this coordinator
 java.lang.String getName()
          Get the wetware readable name for this coordinator.
 void handleEvent(Endpoint endpoint)
           
 void registerForEvents(Endpoint endpoint)
          Register the given endpoint to receive events.
 void removeEndpoint(Endpoint endpoint)
           
 void start()
          Start this EndpointCoordinator - generally initializes all of the worker threads associated with this coordinator.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EndpointCoordinator

public EndpointCoordinator(EIOGlobalContext context,
                           java.lang.String name,
                           EIOWorkerFactory factory,
                           EIOPoolingStrategy strategy)
Construct a new EndpointCoordinator.

Parameters:
context - the global context this coordinator will be running within
name - a wetware readable name for this component
factory - A factory to use to construct workers. These workers are used to service events fired against endpoints of this type.
strategy - the strategy used to handle endpoints of this type.
Method Detail

getContext

public EIOGlobalContext getContext()
Get the global context associated with this EndpointCoordinator.


getEventDescriptor

public EIOEventDescriptor getEventDescriptor(EIOEvent event)
Return an event descriptor that defines this coordinator's pooling strategy for a given event.


start

public void start()
Start this EndpointCoordinator - generally initializes all of the worker threads associated with this coordinator. Your endpoints won't do anything until you call start() on them. NOTE: EIOEventManger will generally call this for you, so long as you add your endpoints to the EIOEventManager you should be golden. Just don't forget to call start() on the EIOEventManager!


getEventManager

public EIOEventManager getEventManager()
Get the event manager associated with this coordinator


handleEvent

public void handleEvent(Endpoint endpoint)

registerForEvents

public void registerForEvents(Endpoint endpoint)
Register the given endpoint to receive events. Uses the endpoint's ready indicators to figure out which events exactly. End users shouldn't touch this - bad baby, bad bad baby!!!


removeEndpoint

public void removeEndpoint(Endpoint endpoint)

dumpEndpoints

public void dumpEndpoints()
Only here for debugging purposes


getName

public java.lang.String getName()
Get the wetware readable name for this coordinator.


toString

public java.lang.String toString()


Pyrasun EmberIO