Class ConnectionImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.network.ConnectionImpl
-
- All Implemented Interfaces:
Connection
public class ConnectionImpl extends java.lang.Object implements Connection
-
-
Field Summary
Fields Modifier and Type Field Description private NetworkConnection
core_connection
private IncomingMessageQueueImpl
in_queue
private boolean
incoming
private OutgoingMessageQueueImpl
out_queue
private TransportImpl
transport
-
Constructor Summary
Constructors Constructor Description ConnectionImpl(NetworkConnection core_connection, boolean incoming)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close and shutdown this connection.void
connect(ConnectionListener listener)
Connect this connection's transport, i.e.NetworkConnection
getCoreConnection()
IncomingMessageQueue
getIncomingMessageQueue()
Get the connection's incoming message queue.OutgoingMessageQueue
getOutgoingMessageQueue()
Get the connection's outgoing message queue.java.lang.String
getString()
descriptive text for the connectionTransport
getTransport()
Returns the transport object for this connection.boolean
isIncoming()
Returns true if the connection represents an incoming connection.void
startMessageProcessing()
Begin processing incoming and outgoing message queues.
-
-
-
Field Detail
-
core_connection
private final NetworkConnection core_connection
-
out_queue
private final OutgoingMessageQueueImpl out_queue
-
in_queue
private final IncomingMessageQueueImpl in_queue
-
transport
private final TransportImpl transport
-
incoming
private final boolean incoming
-
-
Constructor Detail
-
ConnectionImpl
public ConnectionImpl(NetworkConnection core_connection, boolean incoming)
-
-
Method Detail
-
connect
public void connect(ConnectionListener listener)
Description copied from interface:Connection
Connect this connection's transport, i.e. establish the peer connection. If this connection is already established (from an incoming connection for example), then this provides a mechanism to register the connection listener, in which case connectSuccess() will be called immediately.- Specified by:
connect
in interfaceConnection
- Parameters:
listener
- notified on connect success or failure
-
close
public void close()
Description copied from interface:Connection
Close and shutdown this connection.- Specified by:
close
in interfaceConnection
-
getOutgoingMessageQueue
public OutgoingMessageQueue getOutgoingMessageQueue()
Description copied from interface:Connection
Get the connection's outgoing message queue.- Specified by:
getOutgoingMessageQueue
in interfaceConnection
- Returns:
- outbound message queue
-
getIncomingMessageQueue
public IncomingMessageQueue getIncomingMessageQueue()
Description copied from interface:Connection
Get the connection's incoming message queue.- Specified by:
getIncomingMessageQueue
in interfaceConnection
- Returns:
- inbound message queue
-
startMessageProcessing
public void startMessageProcessing()
Description copied from interface:Connection
Begin processing incoming and outgoing message queues.- Specified by:
startMessageProcessing
in interfaceConnection
-
getTransport
public Transport getTransport()
Description copied from interface:Connection
Returns the transport object for this connection.- Specified by:
getTransport
in interfaceConnection
-
getCoreConnection
public NetworkConnection getCoreConnection()
-
isIncoming
public boolean isIncoming()
Description copied from interface:Connection
Returns true if the connection represents an incoming connection.- Specified by:
isIncoming
in interfaceConnection
-
getString
public java.lang.String getString()
Description copied from interface:Connection
descriptive text for the connection- Specified by:
getString
in interfaceConnection
- Returns:
-
-