|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
T - the address family encapsulated by this Connector's
associated Endpointpublic interface Connector<T>
Actively initiates a single connection to an Endpoint and
asynchronously notifies the associated ConnectionListener when the
connection completes.
A connection attempt may be terminated by a call to shutdown(),
unless the connection has already finished connecting. Once a
Connector has connected or shut down, it may not be reused.
| Method Summary | |
|---|---|
void |
connect(ConnectionListener listener)
Actively initiates a connection to the associated Endpoint. |
Endpoint<T> |
getEndpoint()
Returns the Endpoint for this Connector. |
boolean |
isConnected()
Returns true if this connector is connected, otherwise
returns false. |
void |
shutdown()
Shuts down this Connector. |
boolean |
waitForConnect(long timeout)
Waits for the connect attempt, initiated by invoking the connect method, to complete with the given timeout (specified in milliseconds), and returns true
if the connect attempt completed. |
| Method Detail |
|---|
void connect(ConnectionListener listener)
throws IOException
Endpoint.
This call is non-blocking.
connected will be called
asynchronously on the given listener upon successful
connection, or disconnected
if it fails.
listener - the listener for all IO events on the connection,
including the result of the connection attempt
IOException - if there was a problem initiating the connection
IllegalStateException - if the Connector has been shut
down or has already attempted a connection
boolean waitForConnect(long timeout)
throws IOException,
InterruptedException
connect method, to complete with the given timeout (specified in milliseconds), and returns true
if the connect attempt completed.
Use the isConnected method on this
instance to determine if the connect attempt was successful.
timeout - the wait timeout
true if the connect attempt completed
IllegalStateException - if no connect attempt is in progress
InterruptedException - if the waiting thread is interrupted
IOException - if the implementation determines that the connect
attempt failed with an IOExceptionboolean isConnected()
true if this connector is connected, otherwise
returns false.
true if this connector is connectedEndpoint<T> getEndpoint()
Endpoint for this Connector.
Endpoint for this Connectorvoid shutdown()
Connector. The pending connection attempt
will be cancelled.
IllegalStateException - if there is no connection attempt in
progress
|
Project Darkstar, Version 0.9.11.2 2013-07-29 21:50:09 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||