pyrasun.eio.helpers
Class EIOAcceptWorkerFactory

java.lang.Object
  extended bypyrasun.eio.helpers.EIOAcceptWorkerFactory
All Implemented Interfaces:
EIOWorkerFactory

public class EIOAcceptWorkerFactory
extends java.lang.Object
implements EIOWorkerFactory

A factory and helper for creating simple EIOWorker objects which accept connections from a SocketServer and creates a proper ReadWriteEndpoint. You pass it in the EndpointCoordinator for the resulting ReadWriteEndpoints, a listener to be informed when new connections are coming in and being created, a callback which serves a curiously similar function to the listener. You can also optionally set a factory (EIOEndpointFactory) for manufacturing the ReadWriteEndpoint instances that are created (in case you want to create a specialized Endpoint that extends ReadWriteEndpoint). This class relies on the fact that the activated Endpoint comes in as a parameter to the worker (ACCEPT worker in this case). So we get the AcceptingEndpoint object directly from there, so there's no need to pass it in.


Nested Class Summary
static class EIOAcceptWorkerFactory.EIOAcceptingWorker
          A default class for doing socket accepts.
static interface EIOAcceptWorkerFactory.EIOAcceptWorkerCallback
           
 
Constructor Summary
EIOAcceptWorkerFactory(EndpointCoordinator coordinator, EndpointEventListener listener)
           
EIOAcceptWorkerFactory(EndpointCoordinator coordinator, EndpointEventListener listener, EIOAcceptWorkerFactory.EIOAcceptWorkerCallback callback)
           
 
Method Summary
 EIOWorker createWorker(EIOEvent type)
          Create a worker of the given type
 void setEndpointFactory(EIOEndpointFactory factory)
           
 EIOEvent[] supportedWorkerTypes()
          Returns an array of supported Event types for this factory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EIOAcceptWorkerFactory

public EIOAcceptWorkerFactory(EndpointCoordinator coordinator,
                              EndpointEventListener listener)

EIOAcceptWorkerFactory

public EIOAcceptWorkerFactory(EndpointCoordinator coordinator,
                              EndpointEventListener listener,
                              EIOAcceptWorkerFactory.EIOAcceptWorkerCallback callback)
Method Detail

setEndpointFactory

public void setEndpointFactory(EIOEndpointFactory factory)

createWorker

public EIOWorker createWorker(EIOEvent type)
                       throws java.lang.IllegalArgumentException
Description copied from interface: EIOWorkerFactory
Create a worker of the given type

Specified by:
createWorker in interface EIOWorkerFactory
Throws:
java.lang.IllegalArgumentException
See Also:
for a list of valid types If the factory does not support a given worker type, it should throw an IllegalArgumentException

supportedWorkerTypes

public EIOEvent[] supportedWorkerTypes()
Description copied from interface: EIOWorkerFactory
Returns an array of supported Event types for this factory.

Specified by:
supportedWorkerTypes in interface EIOWorkerFactory


Pyrasun EmberIO