public final class Flags extends Object
| Modifier and Type | Method and Description |
|---|---|
static ExceptionVerbosity |
annotatedServiceExceptionVerbosity()
Returns the verbosity of exceptions logged by annotated HTTP services.
|
static List<String> |
cachedHeaders()
Returns the value of the
cachedHeaders parameter which contains a comma-separated list of
headers whose values are cached using headerValueCache. |
static String |
compositeServiceCacheSpec()
Returns the value of the
compositeServiceCache parameter. |
static String |
defaultBackoffSpec()
Returns the default value of the
backoffSpec parameter when instantiating a Backoff
using Backoff.of(String). |
static long |
defaultClientIdleTimeoutMillis()
Returns the default client-side idle timeout of a connection for keep-alive in milliseconds.
|
static long |
defaultConnectTimeoutMillis()
Returns the default client-side timeout of a socket connection attempt in milliseconds.
|
static int |
defaultHttp1MaxChunkSize()
Returns the default maximum length of each chunk in an HTTP/1 response content.
|
static int |
defaultHttp1MaxHeaderSize()
Returns the default maximum length of all headers in an HTTP/1 response.
|
static int |
defaultHttp1MaxInitialLineLength()
Returns the default maximum length of an HTTP/1 response initial line.
|
static int |
defaultHttp2InitialConnectionWindowSize()
Returns the default value of the
ServerBuilder.http2InitialConnectionWindowSize(int) and
ClientFactoryBuilder.http2InitialConnectionWindowSize(int) option. |
static int |
defaultHttp2InitialStreamWindowSize()
Returns the default value of the
ServerBuilder.http2InitialStreamWindowSize(int) and
ClientFactoryBuilder.http2InitialStreamWindowSize(int) option. |
static int |
defaultHttp2MaxFrameSize()
Returns the default value of the
ServerBuilder.http2MaxFrameSize(int) and
ClientFactoryBuilder.http2MaxFrameSize(int) option. |
static long |
defaultHttp2MaxHeaderListSize()
Returns the default value of the
ServerBuilder.http2MaxHeaderListSize(long) and
ClientFactoryBuilder.http2MaxHeaderListSize(long) option. |
static long |
defaultHttp2MaxStreamsPerConnection()
Returns the default value of the
ServerBuilder.http2MaxStreamsPerConnection(long) option. |
static long |
defaultMaxRequestLength()
Returns the default server-side maximum length of a request.
|
static long |
defaultMaxResponseLength()
Returns the default client-side maximum length of a response.
|
static int |
defaultMaxTotalAttempts()
Returns the default maximum number of total attempts.
|
static long |
defaultRequestTimeoutMillis()
Returns the default server-side timeout of a request in milliseconds.
|
static long |
defaultResponseTimeoutMillis()
Returns the default client-side timeout of a response in milliseconds.
|
static long |
defaultServerIdleTimeoutMillis()
Returns the default server-side idle timeout of a connection for keep-alive in milliseconds.
|
static boolean |
defaultUseHttp1Pipelining()
Returns the default value of the
ClientFactoryBuilder.useHttp1Pipelining(boolean) option. |
static boolean |
defaultUseHttp2Preface()
Returns the default value of the
ClientFactoryBuilder.useHttp2Preface(boolean) option. |
static long |
defaultWriteTimeoutMillis()
Returns the default client-side timeout of a socket write attempt in milliseconds.
|
static boolean |
dumpOpenSslInfo()
Returns whether information about the OpenSSL environment should be dumped when first starting the
application, including supported ciphers.
|
static String |
fileServiceCacheSpec()
Returns the value of the
fileServiceCache parameter. |
static String |
headerValueCacheSpec()
Returns the value of the
headerValueCache parameter. |
static int |
maxNumConnections()
Returns the default server-side maximum number of connections.
|
static int |
numCommonBlockingTaskThreads()
Returns the default number of blocking task executor
threads.
|
static int |
numCommonWorkers()
Returns the default number of common worker group threads.
|
static String |
parsedPathCacheSpec()
Returns the value of the
parsedPathCache parameter. |
static boolean |
reportBlockedEventLoop()
Returns whether
CompletableFutures returned by Armeria methods log a warning if
CompletableFuture.join() or CompletableFuture.get() are called from an event loop thread. |
static String |
routeCacheSpec()
Returns the value of the
routeCache parameter. |
static String |
routeDecoratorCacheSpec()
Returns the value of the
routeDecoratorCache parameter. |
static boolean |
useEpoll()
Returns whether the JNI-based
/dev/epoll socket I/O is enabled. |
static boolean |
useJdkDnsResolver()
Enables
DefaultAddressResolverGroup that resolves domain name using JDK's built-in domain name
lookup mechanism. |
static boolean |
useLegacyMeterNames()
Returns whether to switch back to Armeria's legacy
Meter and Tag naming convention
that is not compliant with Micrometer's default NamingConvention. |
static boolean |
useOpenSsl()
Returns whether the JNI-based TLS support with OpenSSL is enabled.
|
static boolean |
validateHeaders()
Enables validation of HTTP headers for dangerous characters like newlines - such characters can be used
for injecting arbitrary content into HTTP responses.
|
static Sampler<Class<? extends Throwable>> |
verboseExceptionSampler()
Returns the
Sampler that determines whether to retain the stack trace of the exceptions
that are thrown frequently by Armeria. |
static String |
verboseExceptionSamplerSpec()
Returns the specification string of the
Sampler that determines whether to retain the stack
trace of the exceptions that are thrown frequently by Armeria. |
static boolean |
verboseResponses()
Returns whether the verbose response mode is enabled.
|
static boolean |
verboseSocketExceptions()
Returns whether to log the socket exceptions which are mostly harmless.
|
public static Sampler<Class<? extends Throwable>> verboseExceptionSampler()
Sampler that determines whether to retain the stack trace of the exceptions
that are thrown frequently by Armeria.verboseExceptionSamplerSpec()public static String verboseExceptionSamplerSpec()
Sampler that determines whether to retain the stack
trace of the exceptions that are thrown frequently by Armeria. A sampled exception will have the stack
trace while the others will have an empty stack trace to eliminate the cost of capturing the stack
trace.
The default value of this flag is , which retains
the stack trace of the exceptions at the maximum rate of 10 exceptions/sec.
Specify the -Dcom.linecorp.armeria.verboseExceptions=<specification> JVM option to override
the default. See Sampler.of(String) for the specification string format.
public static boolean verboseSocketExceptions()
ClosedChannelExceptionClosedSessionExceptionIOException - 'Connection reset/closed/aborted by peer'Http2Exception - 'Stream closed'SSLException - 'SSLEngine closed already'It is recommended to keep this flag disabled, because it increases the amount of log messages for the errors you usually do not have control over, e.g. unexpected socket disconnection due to network or remote peer issues.
This flag is disabled by default.
Specify the -Dcom.linecorp.armeria.verboseSocketExceptions=true JVM option to enable it.
Exceptions.isExpected(Throwable)public static boolean verboseResponses()
This flag is disabled by default. Specify the -Dcom.linecorp.armeria.verboseResponses=true
JVM option or use ServerBuilder.verboseResponses(boolean) to enable it.
public static boolean useEpoll()
/dev/epoll socket I/O is enabled. When enabled on Linux, Armeria
uses /dev/epoll directly for socket I/O. When disabled, java.nio socket API is used
instead.
This flag is enabled by default for supported platforms. Specify the
-Dcom.linecorp.armeria.useEpoll=false JVM option to disable it.
public static boolean useOpenSsl()
SSLEngine is used
instead.
This flag is enabled by default for supported platforms. Specify the
-Dcom.linecorp.armeria.useOpenSsl=false JVM option to disable it.
public static boolean dumpOpenSslInfo()
This flag is disabled by default. Specify the -Dcom.linecorp.armeria.dumpOpenSslInfo=true JVM
option to enable it.
If useOpenSsl() returns false, this also returns false no matter you
specified the JVM option.
public static int maxNumConnections()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.maxNumConnections=<integer> JVM option to override
the default value.
public static int numCommonWorkers()
The default value of this flag is 2 * <numCpuCores>. Specify the
-Dcom.linecorp.armeria.numCommonWorkers=<integer> JVM option to override the default value.
public static int numCommonBlockingTaskThreads()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.numCommonBlockingTaskThreads=<integer> JVM option to override
the default value.
public static long defaultMaxRequestLength()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultMaxRequestLength=<long> to override the default value.
0 disables the length limit.
public static long defaultMaxResponseLength()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultMaxResponseLength=<long> to override the default value.
0 disables the length limit.
public static long defaultRequestTimeoutMillis()
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultRequestTimeoutMillis=<long> to override
the default value. 0 disables the timeout.
public static long defaultResponseTimeoutMillis()
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultResponseTimeoutMillis=<long> to override
the default value. 0 disables the timeout.
public static long defaultConnectTimeoutMillis()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultConnectTimeoutMillis=<integer> JVM option to override
the default value.
public static long defaultWriteTimeoutMillis()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultWriteTimeoutMillis=<integer> JVM option to override
the default value. 0 disables the timeout.
public static long defaultServerIdleTimeoutMillis()
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultServerIdleTimeoutMillis=<integer> JVM option to override
the default value.
public static long defaultClientIdleTimeoutMillis()
This default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultClientIdleTimeoutMillis=<integer> JVM option to override
the default value.
public static int defaultHttp1MaxInitialLineLength()
This default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp1MaxInitialLineLength=<integer> JVM option
to override the default value.
public static int defaultHttp1MaxHeaderSize()
This default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp1MaxHeaderSize=<integer> JVM option
to override the default value.
public static int defaultHttp1MaxChunkSize()
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp1MaxChunkSize=<integer> JVM option
to override the default value.
public static boolean defaultUseHttp2Preface()
ClientFactoryBuilder.useHttp2Preface(boolean) option.
Note that this value has effect only if a user did not specify it.
This flag is enabled by default. Specify the
-Dcom.linecorp.armeria.defaultUseHttp2Preface=false JVM option to disable it.
public static boolean defaultUseHttp1Pipelining()
ClientFactoryBuilder.useHttp1Pipelining(boolean) option.
Note that this value has effect only if a user did not specify it.
This flag is disabled by default. Specify the
-Dcom.linecorp.armeria.defaultUseHttp1Pipelining=true JVM option to enable it.
public static int defaultHttp2InitialConnectionWindowSize()
ServerBuilder.http2InitialConnectionWindowSize(int) and
ClientFactoryBuilder.http2InitialConnectionWindowSize(int) option.
Note that this value has effect only if a user did not specify it.
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp2InitialConnectionWindowSize=<integer> JVM option
to override the default value.
public static int defaultHttp2InitialStreamWindowSize()
ServerBuilder.http2InitialStreamWindowSize(int) and
ClientFactoryBuilder.http2InitialStreamWindowSize(int) option.
Note that this value has effect only if a user did not specify it.
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp2InitialStreamWindowSize=<integer> JVM option
to override the default value.
public static int defaultHttp2MaxFrameSize()
ServerBuilder.http2MaxFrameSize(int) and
ClientFactoryBuilder.http2MaxFrameSize(int) option.
Note that this value has effect only if a user did not specify it.
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp2MaxFrameSize=<integer> JVM option
to override the default value.
public static long defaultHttp2MaxStreamsPerConnection()
ServerBuilder.http2MaxStreamsPerConnection(long) option.
Note that this value has effect only if a user did not specify it.
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp2MaxStreamsPerConnection=<integer> JVM option
to override the default value.
public static long defaultHttp2MaxHeaderListSize()
ServerBuilder.http2MaxHeaderListSize(long) and
ClientFactoryBuilder.http2MaxHeaderListSize(long) option.
Note that this value has effect only if a user did not specify it.
The default value of this flag is .
Specify the -Dcom.linecorp.armeria.defaultHttp2MaxHeaderListSize=<integer> JVM option
to override the default value.
public static String defaultBackoffSpec()
backoffSpec parameter when instantiating a Backoff
using Backoff.of(String). Note that this value has effect only if a user did not specify the
defaultBackoffSpec in the constructor call.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultBackoffSpec=<spec> JVM option to override the default value.
public static int defaultMaxTotalAttempts()
RetryingClient or a RetryingRpcClient.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.defaultMaxTotalAttempts=<integer> JVM option to
override the default value.
public static String routeCacheSpec()
routeCache parameter. It would be used to create a Caffeine
Cache instance using CaffeineSpec for routing a request. The Cache
would hold the mappings of RoutingContext and the designated ServiceConfig
for a request to improve server performance.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.routeCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.routeCache=maximumSize=4096,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.routeCache=off JVM option to disable it.
public static String routeDecoratorCacheSpec()
routeDecoratorCache parameter. It would be used to create a Caffeine
Cache instance using CaffeineSpec for mapping a route to decorator.
The Cache would hold the mappings of RoutingContext and the designated
dispatcher Services for a request to improve server performance.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.routeDecoratorCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.routeDecoratorCache=maximumSize=4096,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.routeDecoratorCache=off JVM option to disable it.
public static String parsedPathCacheSpec()
parsedPathCache parameter. It would be used to create a Caffeine
Cache instance using CaffeineSpec for mapping raw HTTP paths to parsed pair of
path and query, after validation.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.parsedPathCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.parsedPathCache=maximumSize=4096,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.parsedPathCache=off JVM option to disable it.
public static String headerValueCacheSpec()
headerValueCache parameter. It would be used to create a Caffeine
Cache instance using CaffeineSpec for mapping raw HTTP ASCII header values to
String.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.headerValueCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.headerValueCache=maximumSize=4096,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.headerValueCache=off JVM option to disable it.
public static String fileServiceCacheSpec()
fileServiceCache parameter. It would be used to create a Caffeine
Cache instance using CaffeineSpec for caching file entries.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.fileServiceCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.fileServiceCache=maximumSize=1024,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.fileServiceCache=off JVM option to disable it.
public static List<String> cachedHeaders()
cachedHeaders parameter which contains a comma-separated list of
headers whose values are cached using headerValueCache.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.cachedHeaders=<csv> JVM option to override the default value.
public static String compositeServiceCacheSpec()
compositeServiceCache parameter. It would be used to create a
Caffeine Cache instance using CaffeineSpec for routing a request.
The Cache would hold the mappings of RoutingContext and the designated
ServiceConfig for a request to improve server performance.
The default value of this flag is . Specify the
-Dcom.linecorp.armeria.compositeServiceCache=<spec> JVM option to override the default value.
For example, -Dcom.linecorp.armeria.compositeServiceCache=maximumSize=256,expireAfterAccess=600s.
Also, specify -Dcom.linecorp.armeria.compositeServiceCache=off JVM option to disable it.
public static ExceptionVerbosity annotatedServiceExceptionVerbosity()
ExceptionVerbosity.ALL - logging all exceptions raised from annotated HTTP servicesExceptionVerbosity.UNHANDLED - logging exceptions which are not handled by
ExceptionHandlers provided by a user and are not well-known exceptions
ExceptionVerbosity.NONE - no logging exceptionsWARN level.
The default value of this flag is .
Specify the
-Dcom.linecorp.armeria.annotatedServiceExceptionVerbosity=<all|unhandled|none> JVM option
to override the default value.
ExceptionVerbositypublic static boolean useJdkDnsResolver()
DefaultAddressResolverGroup that resolves domain name using JDK's built-in domain name
lookup mechanism.
Note that JDK's built-in resolver performs a blocking name lookup from the caller thread, and thus
this flag should be enabled only when the default asynchronous resolver does not work as expected,
for example by always throwing a DnsNameResolverTimeoutException.
This flag is disabled by default.
Specify the -Dcom.linecorp.armeria.useJdkDnsResolver=true JVM option
to enable it.
public static boolean reportBlockedEventLoop()
CompletableFutures returned by Armeria methods log a warning if
CompletableFuture.join() or CompletableFuture.get() are called from an event loop thread.
Blocking an event loop thread in this manner reduces performance significantly, possibly causing
deadlocks, so it should be avoided at all costs (e.g. using thenApply() type methods to execute
asynchronously or running the logic using ServiceRequestContext.blockingTaskExecutor().
This flag is enabled by default.
Specify the -Dcom.linecorp.armeria.reportBlockedEventLoop=false JVM option
to disable it.
public static boolean validateHeaders()
DISCLAIMER: Do not disable this unless you know what you are doing. It is recommended to keep this validation enabled to ensure the sanity of responses. However, you may wish to disable the validation to improve performance when you are sure responses are always safe, for example when only HTTP/2 is used, or when you populate headers with known values, and have no chance of using untrusted ones.
See CWE-113 for more details on the security implications of this flag.
This flag is enabled by default.
Specify the -Dcom.linecorp.armeria.validateHeaders=false JVM option to disable it.
public static boolean useLegacyMeterNames()
Meter and Tag naming convention
that is not compliant with Micrometer's default NamingConvention.
This flag is disabled by default. Specify the -Dcom.linecorp.armeria.useLegacyMeterNames=true
JVM option to enable it.
Copyright © 2020 LeanCloud. All rights reserved.