public class TcpChannelHub extends Object implements View, net.openhft.chronicle.core.io.Closeable
| Modifier and Type | Class and Description |
|---|---|
static interface |
TcpChannelHub.Task |
| Modifier and Type | Field and Description |
|---|---|
static int |
HEATBEAT_PING_PERIOD |
static int |
HEATBEAT_TIMEOUT_PERIOD |
protected String |
name |
protected InetSocketAddress |
remoteAddress |
static int |
SIZE_OF_SIZE |
protected int |
tcpBufferSize |
long |
timeoutMs |
| Constructor and Description |
|---|
TcpChannelHub(SessionProvider sessionProvider,
String description,
net.openhft.chronicle.threads.api.EventLoop eventLoop,
java.util.function.Function<net.openhft.chronicle.bytes.Bytes,net.openhft.chronicle.wire.Wire> wire,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkConnection()
blocks until there is a connection
|
void |
close()
called when we are completed finished with using the TcpChannelHub
|
protected void |
closeSocket()
closes the existing connections and establishes a new closeables
|
boolean |
isOpen() |
void |
lock(TcpChannelHub.Task r) |
long |
nextUniqueTransaction(long time)
the transaction id are generated as unique timestamps
|
ReentrantLock |
outBytesLock() |
net.openhft.chronicle.wire.Wire |
outWire() |
net.openhft.chronicle.wire.Wire |
proxyReply(long timeoutTime,
long tid) |
void |
subscribe(AsyncSubscription asyncSubscription)
sets up subscriptions with the server, even if the socket connection is down, the
subscriptions will be re-establish with the server automatically once it comes back up.
|
String |
toString() |
void |
unsubscribe(long tid)
closes a subscription established by
net.openhft.chronicle.network.connection.TcpChannelHub#
subscribe(net.openhft.chronicle.network.connection.AsyncSubscription) |
void |
writeAsyncHeader(net.openhft.chronicle.wire.Wire wire,
String csp,
long cid)
The writes the meta data to wire - the async version does not contain the tid
|
void |
writeMetaDataForKnownTID(long tid,
net.openhft.chronicle.wire.Wire wire,
String csp,
long cid) |
long |
writeMetaDataStartTime(long startTime,
net.openhft.chronicle.wire.Wire wire,
String csp,
long cid) |
void |
writeSocket(net.openhft.chronicle.wire.WireOut wire)
sends data to the server via TCP/IP
|
public static final int HEATBEAT_PING_PERIOD
public static final int HEATBEAT_TIMEOUT_PERIOD
public static final int SIZE_OF_SIZE
public final long timeoutMs
@NotNull protected final String name
@NotNull protected final InetSocketAddress remoteAddress
protected final int tcpBufferSize
public TcpChannelHub(@NotNull
SessionProvider sessionProvider,
@NotNull
String description,
@NotNull
net.openhft.chronicle.threads.api.EventLoop eventLoop,
@NotNull
java.util.function.Function<net.openhft.chronicle.bytes.Bytes,net.openhft.chronicle.wire.Wire> wire,
@NotNull
String name)
public void subscribe(@NotNull
AsyncSubscription asyncSubscription)
net.openhft.chronicle.network.connection.TcpChannelHub#unsubscribe(long)asyncSubscription - detail of the subscription that you wish to hold with the serverpublic void unsubscribe(long tid)
net.openhft.chronicle.network.connection.TcpChannelHub#
subscribe(net.openhft.chronicle.network.connection.AsyncSubscription)tid - the unique id of this subscription@NotNull public ReentrantLock outBytesLock()
protected void closeSocket()
public boolean isOpen()
public void close()
close in interface Closeableclose in interface AutoCloseablepublic long nextUniqueTransaction(long time)
time - in millisecondspublic void writeSocket(@NotNull
net.openhft.chronicle.wire.WireOut wire)
wire - the wire containing the outbound datapublic net.openhft.chronicle.wire.Wire proxyReply(long timeoutTime,
long tid)
public net.openhft.chronicle.wire.Wire outWire()
public long writeMetaDataStartTime(long startTime,
@NotNull
net.openhft.chronicle.wire.Wire wire,
String csp,
long cid)
public void writeMetaDataForKnownTID(long tid,
@NotNull
net.openhft.chronicle.wire.Wire wire,
@Nullable
String csp,
long cid)
public void writeAsyncHeader(@NotNull
net.openhft.chronicle.wire.Wire wire,
String csp,
long cid)
wire - the wire that we will write tocsp - provide either the csp or the cidcid - provide either the csp or the cidpublic void lock(@NotNull
TcpChannelHub.Task r)
public void checkConnection()
Copyright © 2015. All rights reserved.