|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.io.SocketConnector
class SocketConnector
This is a socket-based implementation of an Connector using
the Apache MINA framework for the underlying transport. It uses an
IoConnector to initiate connections on
remote hosts.
Its constructor is package-private, so use Endpoint.createConnector()
to create an instance. This implementation is thread-safe.
| Nested Class Summary | |
|---|---|
(package private) static class |
SocketConnector.ConnectorConnListner
Internal adaptor class to handle events from the connector itself. |
| Constructor Summary | |
|---|---|
SocketConnector(SocketEndpoint endpoint,
org.apache.mina.common.IoConnector connector)
Constructs a SocketConnector using the given
IoConnector for the underlying transport. |
|
| Method Summary | |
|---|---|
void |
connect(ConnectionListener listener)
Actively initiates a connection to the associated Endpoint. |
SocketEndpoint |
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
SocketConnector(SocketEndpoint endpoint,
org.apache.mina.common.IoConnector connector)
SocketConnector using the given
IoConnector for the underlying transport. This constructor is
only visible to the package, so use one of the
ConnectorFactory.createConnector methods to create a new
instance.
endpoint - the remote address to which to connectconnector - the MINA IoConnector to use
for establishing the connection| Method Detail |
|---|
public void connect(ConnectionListener listener)
Endpoint.
This call is non-blocking.
connected will be called
asynchronously on the given listener upon successful
connection, or disconnected
if it fails.
This implementation ensures that only complete messages are delivered on the connection that it connects.
connect in interface Connector<SocketAddress>listener - the listener for all IO events on the connection,
including the result of the connection attemptpublic boolean isConnected()
true if this connector is connected, otherwise
returns false.
isConnected in interface Connector<SocketAddress>true if this connector is connected
public 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.
waitForConnect in interface Connector<SocketAddress>timeout - the wait timeout
true if the connect attempt completed
IOException - if the implementation determines that the connect
attempt failed with an IOException
InterruptedException - if the waiting thread is interruptedpublic void shutdown()
Connector. The pending connection attempt
will be cancelled.
shutdown in interface Connector<SocketAddress>public SocketEndpoint getEndpoint()
Endpoint for this Connector.
getEndpoint in interface Connector<SocketAddress>Endpoint for this Connector
|
Project Darkstar, Version 0.9.10.10 2013-07-29 21:29:09 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||