public class ChronicleGatewayMain extends ChronicleContext implements net.openhft.chronicle.core.io.Closeable, Runnable
This class extends ChronicleContext and implements Closeable and Runnable.
Therefore, instances of this class can manage their own lifecycle and can be executed in separate threads.
The Gateway can be configured using system properties.
| Modifier and Type | Field and Description |
|---|---|
static int |
PORT |
| Constructor and Description |
|---|
ChronicleGatewayMain(String url)
Constructs a new ChronicleGatewayMain instance with a specific URL.
|
ChronicleGatewayMain(String url,
SocketRegistry socketRegistry,
SystemContext systemContext)
Constructs a new ChronicleGatewayMain instance with a specific URL,
socket registry, and system context.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
buffered()
Indicates whether buffering should be used in this context.
|
ChronicleGatewayMain |
buffered(boolean buffered)
Sets whether new connections will be buffered if the client doesn't specify whether buffering should be used.
|
protected static <T extends ChronicleGatewayMain> |
main(Class<T> mainClass,
Function<String,T> supplier,
String config) |
static void |
main(String... args)
The main method acts as the entry point to start the ChronicleGatewayMain.
|
ChronicleGatewayMain |
pauserMode(net.openhft.chronicle.threads.PauserMode pauserMode)
Sets the PauserMode to control the balance between CPU usage and minimising latency
|
protected void |
performClose()
Closes all resources managed by this context in a quiet manner, i.e., without throwing any exceptions.
|
int |
port()
Returns the port number on which the gateway is listening.
|
protected ChannelHeader |
replaceInHeader(ChannelHeader channelHeader)
Allows replacing of the inbound channel header.
|
protected ChannelHeader |
replaceOutHeader(ChannelHeader channelHeader)
Allows replacing of the outbound channel header.
|
void |
run()
Main execution loop for the gateway.
|
ChronicleGatewayMain |
start()
Starts the gateway, binding the server socket channel and starting the acceptor thread if not already running.
|
protected @Nullable ChannelHandler |
validateHandler(Marshallable marshallable)
Validates that the incoming request contains a valid handler.
|
addCloseable, affinityLock, init, name, name, newChannelSupplier, newContext, socketRegistry, startNewGateway, systemContext, systemContext, toFile, toString, url, urlFor, useAffinity, useAffinityclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, closeQuietly, closeQuietlypublic ChronicleGatewayMain(String url) throws net.openhft.chronicle.core.io.InvalidMarshallableException
url - the URL for the Gatewaynet.openhft.chronicle.core.io.InvalidMarshallableException - if there's an issue while creating the gatewaypublic ChronicleGatewayMain(String url, SocketRegistry socketRegistry, SystemContext systemContext) throws net.openhft.chronicle.core.io.InvalidMarshallableException
url - the URL for the GatewaysocketRegistry - the SocketRegistry used by the gateway for managing socket connectionssystemContext - the SystemContext that defines system-level configuration for the gatewaynet.openhft.chronicle.core.io.InvalidMarshallableException - if there's an issue while creating the gatewaypublic static void main(String... args) throws IOException, net.openhft.chronicle.core.io.InvalidMarshallableException
args - Command line arguments. If the first argument is provided, it will be used as the URL for the gateway.IOException - if there is an I/O issue while starting the gatewaynet.openhft.chronicle.core.io.InvalidMarshallableException - if there's an issue while creating the gatewayprotected static <T extends ChronicleGatewayMain> ChronicleGatewayMain main(Class<T> mainClass, Function<String,T> supplier, String config) throws IOException
IOExceptionpublic ChronicleGatewayMain pauserMode(net.openhft.chronicle.threads.PauserMode pauserMode)
pauserMode - to usepublic boolean buffered()
ChronicleContextbuffered in class ChronicleContextpublic ChronicleGatewayMain buffered(boolean buffered)
buffered in class ChronicleContextbuffered - if true.public ChronicleGatewayMain start() throws IOException
IOException - if there is a problem starting the gatewaypublic void run()
protected ChannelHeader replaceInHeader(ChannelHeader channelHeader)
channelHeader - the inbound channel headerprotected ChannelHeader replaceOutHeader(ChannelHeader channelHeader)
channelHeader - the outbound channel headerprotected void performClose()
ChronicleContextperformClose in class ChronicleContext@Nullable protected @Nullable ChannelHandler validateHandler(Marshallable marshallable)
marshallable - the incoming requestpublic int port()
port in class ChronicleContextCopyright © 2023. All rights reserved.