public abstract class ClusterContext<C extends ClusterContext<C,T>,T extends ClusteredNetworkContext<T>>
extends net.openhft.chronicle.wire.SelfDescribingMarshallable
implements net.openhft.chronicle.core.io.Closeable, net.openhft.chronicle.core.io.ManagedCloseable
| Modifier and Type | Field and Description |
|---|---|
static net.openhft.chronicle.threads.PauserMode |
DEFAULT_PAUSER_MODE |
protected net.openhft.chronicle.core.threads.EventLoop |
eventLoop |
| Modifier | Constructor and Description |
|---|---|
protected |
ClusterContext() |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(HostDetails hd)
Start accepting incoming connections
|
String |
affinityCPU() |
C |
affinityCPU(String affinityCPU) |
void |
close()
For ClusterContext we add a stage called "STOPPING" in which we
close the event loops and wait for them to stop.
|
Cluster<T,C> |
cluster() |
void |
cluster(Cluster<T,C> cluster) |
protected abstract String |
clusterNamePrefix() |
void |
connect(HostDetails hd)
Connect to the host specified by the provided
HostDetails. |
ConnectionManager<T> |
connectionManager(int hostId) |
protected void |
defaults() |
@NotNull net.openhft.chronicle.core.threads.EventLoop |
eventLoop()
Lazily created if not supplier by user
|
C |
eventLoop(net.openhft.chronicle.core.threads.EventLoop eventLoop) |
protected List<net.openhft.chronicle.core.threads.EventLoop> |
eventLoopsToStop()
Subclasses may override to close additional EventLoops when STOPPING
|
long |
heartbeatIntervalMs() |
C |
heartbeatIntervalMs(long heartbeatIntervalMs) |
long |
heartbeatTimeoutMs() |
C |
heartbeatTimeoutMs(long heartbeatTimeoutMs) |
boolean |
isClosed() |
boolean |
isClosing() |
byte |
localIdentifier() |
C |
localIdentifier(byte localIdentifier) |
String |
localName() |
C |
localName(String localName) |
Function<C,T> |
networkContextFactory() |
C |
networkContextFactory(Function<C,T> networkContextFactory) |
Function<C,NetworkStatsListener<T>> |
networkStatsListenerFactory() |
C |
networkStatsListenerFactory(Function<C,NetworkStatsListener<T>> networkStatsListenerFactory) |
Supplier<net.openhft.chronicle.threads.Pauser> |
pauserSupplier() |
C |
pauserSupplier(@NotNull Supplier<net.openhft.chronicle.threads.Pauser> pauserSupplier)
Sets the
Pauser Supplier to the provided pauserSupplier. |
protected void |
performClose() |
protected void |
performStop() |
String |
procPrefix() |
void |
procPrefix(String procPrefix) |
void |
readMarshallable(@NotNull net.openhft.chronicle.wire.WireIn wire) |
Supplier<net.openhft.chronicle.threads.Pauser> |
replicationPauserSupplier() |
C |
replicationPauserSupplier(@NotNull Supplier<net.openhft.chronicle.threads.Pauser> replicationPauserSupplier) |
long |
retryInterval() |
C |
retryInterval(long retryInterval) |
ServerThreadingStrategy |
serverThreadingStrategy() |
C |
serverThreadingStrategy(ServerThreadingStrategy serverThreadingStrategy) |
SessionProvider |
sessionProvider() |
C |
sessionProvider(SessionProvider sessionProvider) |
protected net.openhft.chronicle.core.threads.EventLoop |
synchronizedEventLoop() |
abstract @NotNull net.openhft.chronicle.core.util.ThrowingFunction<T,TcpEventHandler<T>,IOException> |
tcpEventHandlerFactory() |
Function<net.openhft.chronicle.wire.WireType,WireOutPublisher> |
wireOutPublisherFactory() |
C |
wireOutPublisherFactory(Function<net.openhft.chronicle.wire.WireType,WireOutPublisher> wireOutPublisherFactory) |
net.openhft.chronicle.wire.WireType |
wireType() |
C |
wireType(net.openhft.chronicle.wire.WireType wireType) |
void |
writeMarshallable(@NotNull net.openhft.chronicle.wire.WireOut wire) |
usesSelfDescribingMessageequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitcreatedHere, throwExceptionIfClosed, warnAndCloseIfNotClosed$equals, $fieldInfoMap, $fieldInfos, $hashCode, $toString, className, copyTo, deepCopy, fromFile, fromFile, fromString, fromString, fromString, getField, getLongField, mergeToMap, reset, setField, setLongField, streamFromFile, streamFromFilepublic static net.openhft.chronicle.threads.PauserMode DEFAULT_PAUSER_MODE
protected transient net.openhft.chronicle.core.threads.EventLoop eventLoop
public void connect(HostDetails hd)
HostDetails. Only attempt connection if the remote host has
lower host ID than local - this is required to avoid bidirectional connection establishmenthd - remote host detailspublic void accept(HostDetails hd)
hd - local host details to accept onpublic ConnectionManager<T> connectionManager(int hostId)
@NotNull public @NotNull net.openhft.chronicle.core.threads.EventLoop eventLoop()
protected net.openhft.chronicle.core.threads.EventLoop synchronizedEventLoop()
@NotNull public C eventLoop(net.openhft.chronicle.core.threads.EventLoop eventLoop)
public String procPrefix()
public void procPrefix(String procPrefix)
public Function<C,NetworkStatsListener<T>> networkStatsListenerFactory()
@NotNull public C networkStatsListenerFactory(Function<C,NetworkStatsListener<T>> networkStatsListenerFactory)
@NotNull public abstract @NotNull net.openhft.chronicle.core.util.ThrowingFunction<T,TcpEventHandler<T>,IOException> tcpEventHandlerFactory()
public C serverThreadingStrategy(ServerThreadingStrategy serverThreadingStrategy)
public ServerThreadingStrategy serverThreadingStrategy()
protected void defaults()
@NotNull public C localIdentifier(byte localIdentifier)
public byte localIdentifier()
public String localName()
@NotNull public C wireType(net.openhft.chronicle.wire.WireType wireType)
public net.openhft.chronicle.wire.WireType wireType()
@NotNull public C heartbeatIntervalMs(long heartbeatIntervalMs)
public long heartbeatIntervalMs()
@NotNull public C heartbeatTimeoutMs(long heartbeatTimeoutMs)
public long heartbeatTimeoutMs()
@NotNull public C pauserSupplier(@NotNull @NotNull Supplier<net.openhft.chronicle.threads.Pauser> pauserSupplier)
Pauser Supplier to the provided pauserSupplier. If the user does not supply an eventLoop() then the pauserSupplier is used when lazily creating the EventGroup.pauserSupplier - to be used by the event looppublic Supplier<net.openhft.chronicle.threads.Pauser> pauserSupplier()
@NotNull public C replicationPauserSupplier(@NotNull @NotNull Supplier<net.openhft.chronicle.threads.Pauser> replicationPauserSupplier)
public Supplier<net.openhft.chronicle.threads.Pauser> replicationPauserSupplier()
public String affinityCPU()
@NotNull public C wireOutPublisherFactory(Function<net.openhft.chronicle.wire.WireType,WireOutPublisher> wireOutPublisherFactory)
public Function<net.openhft.chronicle.wire.WireType,WireOutPublisher> wireOutPublisherFactory()
public C retryInterval(long retryInterval)
public long retryInterval()
public C sessionProvider(SessionProvider sessionProvider)
public SessionProvider sessionProvider()
public void readMarshallable(@NotNull
@NotNull net.openhft.chronicle.wire.WireIn wire)
throws net.openhft.chronicle.core.io.IORuntimeException
readMarshallable in interface net.openhft.chronicle.wire.MarshallablereadMarshallable in interface net.openhft.chronicle.wire.ReadMarshallablenet.openhft.chronicle.core.io.IORuntimeExceptionpublic void writeMarshallable(@NotNull
@NotNull net.openhft.chronicle.wire.WireOut wire)
throws net.openhft.chronicle.core.io.InvalidMarshallableException
writeMarshallable in interface net.openhft.chronicle.wire.MarshallablewriteMarshallable in interface net.openhft.chronicle.wire.WriteMarshallablenet.openhft.chronicle.core.io.InvalidMarshallableExceptionpublic boolean isClosed()
isClosed in interface net.openhft.chronicle.core.io.QueryCloseablepublic boolean isClosing()
isClosing in interface net.openhft.chronicle.core.io.QueryCloseablepublic void close()
ManagedCloseable.throwExceptionIfClosed() does not throw. This allows
the handlers to finish their last iteration without producing
a lot of log noise because the context is closed.
This close() method will block until the event loops are finished and everything is closed.
close in interface Closeableclose in interface AutoCloseableprotected void performStop()
protected List<net.openhft.chronicle.core.threads.EventLoop> eventLoopsToStop()
protected void performClose()
protected abstract String clusterNamePrefix()
Copyright © 2023. All rights reserved.