pyrasun.eio.helpers
Class EIOAcceptWorkerFactory
java.lang.Object
pyrasun.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.
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EIOAcceptWorkerFactory
public EIOAcceptWorkerFactory(EndpointCoordinator coordinator,
EndpointEventListener listener)
EIOAcceptWorkerFactory
public EIOAcceptWorkerFactory(EndpointCoordinator coordinator,
EndpointEventListener listener,
EIOAcceptWorkerFactory.EIOAcceptWorkerCallback callback)
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