org.indi.reactor
Class Connector
java.lang.Object
org.indi.reactor.SimpleEventHandler
org.indi.reactor.Connector
- All Implemented Interfaces:
- EventHandler
public class Connector
- extends SimpleEventHandler
EventHandler for active connection estabishment. The Connector regesters with
the reactor asking to estabish a connection to a particular server during
construction. It called by the reactor and establishes the connection. It
creates a new EventHandler using the given EventHandlerFactory and associates
it with the newly created connection. After completing this work is
unregisters with the reactor.
- Author:
- Dirk Hünniger
Field Summary |
protected EventHandlerFactory |
factory
The EventHandlerFactory used to create new EventHandlers to be
associated with the newly created connection |
Method Summary |
void |
onConnect()
Callback method called by the reactor when the new connection is
ready to be established. |
void |
onConnected(EventHandler h)
Callback method called when the new connection has been established
and a new EvendHandler has be created and associated with it |
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 create new EventHandlers to be
associated with the newly created connection
Connector
public Connector(Reactor r,
EventHandlerFactory f,
java.lang.String host,
int port)
throws java.io.IOException
- Class Constructor
- Parameters:
r
- The reactor to register withf
- The factory used to create a new EventHandler for the
newly created connectionhost
- The host to connect toport
- The port to connect to
- Throws:
java.io.IOException
onConnect
public final void onConnect()
throws java.io.IOException
- Callback method called by the reactor when the new connection is
ready to be established.
- Specified by:
onConnect
in interface EventHandler
- Overrides:
onConnect
in class SimpleEventHandler
- Throws:
java.io.IOException
- See Also:
EventHandler.onConnect()
onConnected
public void onConnected(EventHandler h)
throws java.nio.channels.ClosedChannelException,
java.io.IOException
- Callback method called when the new connection has been established
and a new EvendHandler has be created and associated with it
- Parameters:
h
- The new EventHandler associated with the new
connection
- Throws:
java.nio.channels.ClosedChannelException
java.io.IOException
Copyright © 2008. All Rights Reserved.