public class OutboundConnection
extends java.lang.Object
Channel
.
The underlying socket is not opened until explicitly requested (by sending a message).
TODO: complete this description
Aside from a few administrative methods, the main entry point to sending a message is enqueue(Message)
.
Any thread may send a message (enqueueing it to queue
), but only one thread may consume messages from this
queue. There is a single delivery thread - either the event loop, or a companion thread - that has logical ownership
of the queue, but other threads may temporarily take ownership in order to perform book keeping, pruning, etc.,
to ensure system stability.
Delivery#run()
is the main entry point for consuming messages from the queue, and executes either on the event
loop or on a non-dedicated companion thread. This processing is activated via Delivery#execute()
.
Almost all internal state maintenance on this class occurs on the eventLoop, a single threaded executor which is
assigned in the constructor. Further details are outlined below in the class. Some behaviours require coordination
between the eventLoop and the companion thread (if any). Some minimal set of behaviours are permitted to occur on
producers to ensure the connection remains healthy and does not overcommit resources.
All methods are safe to invoke from any thread unless otherwise stated.Modifier and Type | Method and Description |
---|---|
io.netty.util.concurrent.Future<java.lang.Void> |
close(boolean flushQueue)
Permanently close this connection.
|
long |
connectionAttempts() |
long |
dropped() |
void |
enqueue(Message message)
This is the main entry point for enqueuing a message to be sent to the remote peer.
|
long |
errorBytes() |
long |
errorCount() |
long |
expiredBytes() |
long |
expiredCount() |
boolean |
hasPending() |
boolean |
interrupt()
Close any currently open connection, forcing a reconnect if there are messages outstanding
(or leaving it closed for now otherwise)
|
boolean |
isConnected() |
long |
overloadedBytes() |
long |
overloadedCount() |
long |
pendingBytes() |
int |
pendingCount() |
long |
sentBytes() |
long |
sentCount() |
long |
submittedCount() |
long |
successfulConnections() |
java.lang.String |
toString() |
ConnectionType |
type() |
public void enqueue(Message message) throws java.nio.channels.ClosedChannelException
java.nio.channels.ClosedChannelException
public boolean interrupt()
public io.netty.util.concurrent.Future<java.lang.Void> close(boolean flushQueue)
public boolean isConnected()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean hasPending()
public int pendingCount()
public long pendingBytes()
public long sentCount()
public long sentBytes()
public long submittedCount()
public long dropped()
public long overloadedBytes()
public long overloadedCount()
public long expiredCount()
public long expiredBytes()
public long errorCount()
public long errorBytes()
public long successfulConnections()
public long connectionAttempts()
public ConnectionType type()
Copyright © 2009- The Apache Software Foundation