asynctcp
Class IncomingConnection

java.lang.Object
  extended by asynctcp.Connection
      extended by asynctcp.IncomingConnection

public class IncomingConnection
extends Connection

An interface allowing management of remotely established connections.

Author:
Michael Parker

Nested Class Summary
 
Nested classes/interfaces inherited from class asynctcp.Connection
Connection.ConnectionState
 
Method Summary
 boolean isLocalConnection()
          Returns whether this connection was locally or remotely established.
 Connection.ConnectionState reconnect(long timeout_ms)
          If this connection was established locally, meaning isLocalConnection returns true, then this method attempts to reestablish the connection.
 
Methods inherited from class asynctcp.Connection
attach, attachment, disconnect, getConnectionState, getListener, getMessageQueue, getRemoteHost, setListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLocalConnection

public boolean isLocalConnection()
Description copied from class: Connection
Returns whether this connection was locally or remotely established.

Specified by:
isLocalConnection in class Connection
Returns:
true if this connection was locally established, false otherwise

reconnect

public Connection.ConnectionState reconnect(long timeout_ms)
Description copied from class: Connection
If this connection was established locally, meaning isLocalConnection returns true, then this method attempts to reestablish the connection. If the connection state is currently DISCONNECTING because the queue of this connection is still being emptied, then invoking this method cancels the disconnect and returns the state to CONNECTED. If the connection state is currently DISCONNECTED, then this method will begin establishing a new connection entirely, and change the connection state to CONNECTING. In any other state, invoking this method has no effect.

If this connection was established remotely, and has a state of DISCONNECTING because it is still emptying its message queue, then invoking this method simply cancels the disconnect and returns the state to CONNECTED. In any other state, invoking this method has no effect.

Specified by:
reconnect in class Connection
Parameters:
timeout_ms - the maximum amount of time, in milliseconds, before it is assumed that the connection attempt has failed
Returns:
the new state of the connection