org.indi.reactor
Class Acceptor
java.lang.Object
org.indi.reactor.SimpleEventHandler
org.indi.reactor.Acceptor
- All Implemented Interfaces:
- EventHandler
public class Acceptor
- extends SimpleEventHandler
EventHandler for passive connection establishment. The Acceptor is registered
with the reactor during construction. Whenever a new client connects, on the
specified port a new EventHandler is created using the given
EventHandlerFactory and associated with the newly created connection, as well
as registered with the reactor.
- Author:
- Dirk Hünniger
Method Summary |
void |
onAccept()
Callback method called by the reactor when a new client is ready to
be accepted. |
void |
onAccepted(EventHandler h)
Callbackmethod called after the connection has been established and a
new EventHandler has been created and set up to interact with this
new conenction |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
factory
protected EventHandlerFactory factory
- The EventHandlerFactory used to produce new EventHandlers for new
connections
Acceptor
protected Acceptor(Reactor r,
EventHandlerFactory f,
int port)
throws java.io.IOException
- Class Constructor
- Parameters:
r
- the reactor the Acceptor is to be registered withf
- the EventHandlerFactory to be used for the creation of
new EventHandlers for new connectionsport
- The port to listen for new connections
- Throws:
java.io.IOException
onAccept
public final void onAccept()
throws java.io.IOException
- Callback method called by the reactor when a new client is ready to
be accepted. Implemented here.
- Specified by:
onAccept
in interface EventHandler
- Overrides:
onAccept
in class SimpleEventHandler
- Throws:
java.io.IOException
java.nio.channels.ClosedChannelException
- See Also:
EventHandler.onAccept()
onAccepted
public void onAccepted(EventHandler h)
throws java.nio.channels.ClosedChannelException,
java.io.IOException
- Callbackmethod called after the connection has been established and a
new EventHandler has been created and set up to interact with this
new conenction
- Parameters:
h
- The newly created EventHandler
- Throws:
java.nio.channels.ClosedChannelException
java.io.IOException
Copyright © 2008. All Rights Reserved.