public class ChronicleGatewayMain extends ChronicleContext implements net.openhft.chronicle.core.io.Closeable, Runnable
ChronicleGatewayMain class represents the primary access point for the Chronicle Gateway.
This gateway is pivotal in processing incoming connections and effectively handling requests based on a predetermined protocol.
By extending ChronicleContext and implementing Closeable and Runnable, instances of this class
have the ability to manage their lifecycle autonomously and can operate in individual threads. Configuration of the Gateway
can be done utilizing 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,
net.openhft.chronicle.wire.channel.impl.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()
Checks if the gateway is operating in buffered mode.
|
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)
Generates an instance of the
ChronicleGatewayMain class based on the supplied configuration. |
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, closeCallback, closeCallback, 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, net.openhft.chronicle.wire.channel.impl.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
ChronicleGatewayMain class based on the supplied configuration.T - Represents the subclass type of ChronicleGatewayMain.mainClass - The main class type for creating an instance.supplier - Provides an instance of the main class based on the configuration string.config - The configuration string used for creating the main instance.ChronicleGatewayMain class, created and configured based on the provided arguments.IOException - If there's a problem reading the configuration.public ChronicleGatewayMain pauserMode(net.openhft.chronicle.threads.PauserMode pauserMode)
pauserMode - The pauser mode to be set.ChronicleGatewayMain for chained calls.public boolean buffered()
buffered in class ChronicleContexttrue if in buffered mode, otherwise false.public ChronicleGatewayMain buffered(boolean buffered)
buffered in class ChronicleContextbuffered - Set to true if buffering should be enabled.ChronicleGatewayMain for chained calls.public ChronicleGatewayMain start() throws IOException
IOException - If there's a hiccup during the gateway's startup.public 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 © 2024. All rights reserved.