Package com.linecorp.armeria.client
Class ClientFactoryOptions
java.lang.Object
com.linecorp.armeria.common.util.AbstractOptions<ClientFactoryOption<Object>,ClientFactoryOptionValue<Object>>
com.linecorp.armeria.client.ClientFactoryOptions
- All Implemented Interfaces:
Iterable<ClientFactoryOptionValue<Object>>
public final class ClientFactoryOptions extends AbstractOptions<ClientFactoryOption<Object>,ClientFactoryOptionValue<Object>>
A set of
ClientFactoryOption
s and their respective values.-
Field Summary
Fields Modifier and Type Field Description static ClientFactoryOption<Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>>>
ADDRESS_RESOLVER_GROUP_FACTORY
The factory that creates anAddressResolverGroup
which resolves remote addresses intoInetSocketAddress
es.static ClientFactoryOption<Map<ChannelOption<?>,Object>>
CHANNEL_OPTIONS
TheChannelOption
s of the sockets created by theClientFactory
.static ClientFactoryOption<ConnectionPoolListener>
CONNECTION_POOL_LISTENER
The listener which is notified on a connection pool event.static ClientFactoryOption<Function<? super EventLoopGroup,? extends EventLoopScheduler>>
EVENT_LOOP_SCHEDULER_FACTORY
The factory that creates anEventLoopScheduler
which is responsible for assigning anEventLoop
to handle a connection to the specifiedEndpoint
.static ClientFactoryOption<Http1HeaderNaming>
HTTP1_HEADER_NAMING
TheHttp1HeaderNaming
which converts a lower-cased HTTP/2 header name into another HTTP/1 header name.static ClientFactoryOption<Integer>
HTTP1_MAX_CHUNK_SIZE
The maximum length of each chunk in an HTTP/1 response content.static ClientFactoryOption<Integer>
HTTP1_MAX_HEADER_SIZE
The maximum length of all headers in an HTTP/1 response.static ClientFactoryOption<Integer>
HTTP1_MAX_INITIAL_LINE_LENGTH
The maximum length of an HTTP/1 response initial line.static ClientFactoryOption<Integer>
HTTP2_INITIAL_CONNECTION_WINDOW_SIZE
The HTTP/2 initial connection flow-control window size.static ClientFactoryOption<Integer>
HTTP2_INITIAL_STREAM_WINDOW_SIZE
The SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.static ClientFactoryOption<Integer>
HTTP2_MAX_FRAME_SIZE
The SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive.static ClientFactoryOption<Long>
HTTP2_MAX_HEADER_LIST_SIZE
The HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets.static ClientFactoryOption<Long>
IDLE_TIMEOUT_MILLIS
The idle timeout of a socket connection in milliseconds.static ClientFactoryOption<Long>
MAX_CONNECTION_AGE_MILLIS
The client-side max age of a connection for keep-alive in milliseconds.static ClientFactoryOption<Integer>
MAX_NUM_REQUESTS_PER_CONNECTION
The client-side maximum allowed number of requests that can be sent through one connection.static ClientFactoryOption<MeterRegistry>
METER_REGISTRY
TheMeterRegistry
which collects various stats.static ClientFactoryOption<Long>
PING_INTERVAL_MILLIS
The PING interval in milliseconds.static ClientFactoryOption<ProxyConfigSelector>
PROXY_CONFIG_SELECTOR
TheProxyConfigSelector
which determines theProxyConfig
to be used.static ClientFactoryOption<Boolean>
SHUTDOWN_WORKER_GROUP_ON_CLOSE
Whether to shut down the workerEventLoopGroup
when theClientFactory
is closed.static ClientFactoryOption<Boolean>
TLS_ALLOW_UNSAFE_CIPHERS
Deprecated.It's not recommended to enable this option.static ClientFactoryOption<Consumer<? super SslContextBuilder>>
TLS_CUSTOMIZER
TheConsumer
which can arbitrarily configure theSslContextBuilder
that will be applied to the SSL session.static ClientFactoryOption<Boolean>
USE_HTTP1_PIPELINING
Whether to use HTTP pipelining for HTTP/1 connections.static ClientFactoryOption<Boolean>
USE_HTTP2_PREFACE
Whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection.static ClientFactoryOption<EventLoopGroup>
WORKER_GROUP
The workerEventLoopGroup
. -
Method Summary
Modifier and Type Method Description Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>>
addressResolverGroupFactory()
Returns the factory that creates anAddressResolverGroup
which resolves remote addresses intoInetSocketAddress
es.Map<ChannelOption<?>,Object>
channelOptions()
Returns theChannelOption
s of the sockets created by theClientFactory
.ConnectionPoolListener
connectionPoolListener()
Returns the listener which is notified on a connection pool event.Function<? super EventLoopGroup,? extends EventLoopScheduler>
eventLoopSchedulerFactory()
Returns the factory that creates anEventLoopScheduler
which is responsible for assigning anEventLoop
to handle a connection to the specifiedEndpoint
.Http1HeaderNaming
http1HeaderNaming()
Returns theHttp1HeaderNaming
which converts a lower-cased HTTP/2 header name into another header name.int
http1MaxChunkSize()
Returns the maximum length of each chunk in an HTTP/1 response content.int
http1MaxHeaderSize()
Returns the maximum length of all headers in an HTTP/1 response.int
http1MaxInitialLineLength()
Returns the maximum length of an HTTP/1 response initial line.int
http2InitialConnectionWindowSize()
Returns the HTTP/2 initial connection flow-control window size.int
http2InitialStreamWindowSize()
Returns the SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.int
http2MaxFrameSize()
Returns the SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive.long
http2MaxHeaderListSize()
Returns the HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets.long
idleTimeoutMillis()
Returns the idle timeout of a socket connection in milliseconds.long
maxConnectionAgeMillis()
Returns the client-side max age of a connection for keep-alive in milliseconds.int
maxNumRequestsPerConnection()
Returns the client-side maximum allowed number of requests that can be sent through one connection.MeterRegistry
meterRegistry()
Returns theMeterRegistry
which collects various stats.static ClientFactoryOptions
of()
Returns an empty singletonClientFactoryOptions
.static ClientFactoryOptions
of(ClientFactoryOptions baseOptions, ClientFactoryOptionValue<?>... additionalValues)
Merges the specifiedClientFactoryOptions
andClientFactoryOptionValue
s.static ClientFactoryOptions
of(ClientFactoryOptions baseOptions, Iterable<? extends ClientFactoryOptionValue<?>> additionalValues)
Merges the specifiedClientFactoryOptions
andClientFactoryOptionValue
s.static ClientFactoryOptions
of(ClientFactoryOptionValue<?>... values)
Returns theClientFactoryOptions
with the specifiedClientFactoryOptionValue
s.static ClientFactoryOptions
of(Iterable<? extends ClientFactoryOptionValue<?>> values)
Returns theClientFactoryOptions
with the specifiedClientFactoryOptionValue
s.long
pingIntervalMillis()
Returns the PING interval in milliseconds.ProxyConfigSelector
proxyConfigSelector()
TheProxyConfigSelector
which determines theProxyConfig
to be used.boolean
shutdownWorkerGroupOnClose()
Returns the flag whether to shut down the workerEventLoopGroup
when theClientFactory
is closed.boolean
tlsAllowUnsafeCiphers()
Returns whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.Consumer<? super SslContextBuilder>
tlsCustomizer()
Returns theConsumer
which can arbitrarily configure theSslContextBuilder
that will be applied to the SSL session.boolean
useHttp1Pipelining()
Returns whether to use HTTP pipelining for HTTP/1 connections.boolean
useHttp2Preface()
Returns whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection.EventLoopGroup
workerGroup()
Returns the workerEventLoopGroup
.Methods inherited from class com.linecorp.armeria.common.util.AbstractOptions
asMap, get, iterator, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
WORKER_GROUP
The workerEventLoopGroup
. -
SHUTDOWN_WORKER_GROUP_ON_CLOSE
Whether to shut down the workerEventLoopGroup
when theClientFactory
is closed. -
EVENT_LOOP_SCHEDULER_FACTORY
public static final ClientFactoryOption<Function<? super EventLoopGroup,? extends EventLoopScheduler>> EVENT_LOOP_SCHEDULER_FACTORYThe factory that creates anEventLoopScheduler
which is responsible for assigning anEventLoop
to handle a connection to the specifiedEndpoint
. -
TLS_CUSTOMIZER
TheConsumer
which can arbitrarily configure theSslContextBuilder
that will be applied to the SSL session. -
TLS_ALLOW_UNSAFE_CIPHERS
Deprecated.It's not recommended to enable this option. Use it only when you have no other way to communicate with an insecure peer than this.Whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.Note that enabling this option increases the security risk of your connection. Use it only when you must communicate with a legacy system that does not support secure cipher suites. See Section 9.2.2, RFC7540 for more information.
-
ADDRESS_RESOLVER_GROUP_FACTORY
public static final ClientFactoryOption<Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>>> ADDRESS_RESOLVER_GROUP_FACTORYThe factory that creates anAddressResolverGroup
which resolves remote addresses intoInetSocketAddress
es. -
HTTP2_INITIAL_CONNECTION_WINDOW_SIZE
The HTTP/2 initial connection flow-control window size. -
HTTP2_INITIAL_STREAM_WINDOW_SIZE
The SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control. -
HTTP2_MAX_FRAME_SIZE
The SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive. -
HTTP2_MAX_HEADER_LIST_SIZE
The HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets. -
HTTP1_MAX_INITIAL_LINE_LENGTH
The maximum length of an HTTP/1 response initial line. -
HTTP1_MAX_HEADER_SIZE
The maximum length of all headers in an HTTP/1 response. -
HTTP1_MAX_CHUNK_SIZE
The maximum length of each chunk in an HTTP/1 response content. -
IDLE_TIMEOUT_MILLIS
The idle timeout of a socket connection in milliseconds. -
PING_INTERVAL_MILLIS
-
MAX_CONNECTION_AGE_MILLIS
The client-side max age of a connection for keep-alive in milliseconds. If the value is greater than0
, a connection is disconnected after the specified amount of time since the connection was established. This option is disabled by default, which means unlimited. -
MAX_NUM_REQUESTS_PER_CONNECTION
The client-side maximum allowed number of requests that can be sent through one connection. This option is disabled by default, which means unlimited. -
USE_HTTP2_PREFACE
Whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection. -
USE_HTTP1_PIPELINING
Whether to use HTTP pipelining for HTTP/1 connections. -
CONNECTION_POOL_LISTENER
The listener which is notified on a connection pool event. -
METER_REGISTRY
TheMeterRegistry
which collects various stats. -
PROXY_CONFIG_SELECTOR
TheProxyConfigSelector
which determines theProxyConfig
to be used. -
HTTP1_HEADER_NAMING
TheHttp1HeaderNaming
which converts a lower-cased HTTP/2 header name into another HTTP/1 header name. -
CHANNEL_OPTIONS
TheChannelOption
s of the sockets created by theClientFactory
.
-
-
Method Details
-
of
Returns an empty singletonClientFactoryOptions
. -
of
Returns theClientFactoryOptions
with the specifiedClientFactoryOptionValue
s. -
of
Returns theClientFactoryOptions
with the specifiedClientFactoryOptionValue
s. -
of
public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, ClientFactoryOptionValue<?>... additionalValues)Merges the specifiedClientFactoryOptions
andClientFactoryOptionValue
s.- Returns:
- the merged
ClientFactoryOptions
-
of
public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, Iterable<? extends ClientFactoryOptionValue<?>> additionalValues)Merges the specifiedClientFactoryOptions
andClientFactoryOptionValue
s.- Returns:
- the merged
ClientFactoryOptions
-
workerGroup
Returns the workerEventLoopGroup
. -
shutdownWorkerGroupOnClose
public boolean shutdownWorkerGroupOnClose()Returns the flag whether to shut down the workerEventLoopGroup
when theClientFactory
is closed. -
eventLoopSchedulerFactory
Returns the factory that creates anEventLoopScheduler
which is responsible for assigning anEventLoop
to handle a connection to the specifiedEndpoint
. -
channelOptions
Returns theChannelOption
s of the sockets created by theClientFactory
. -
tlsCustomizer
Returns theConsumer
which can arbitrarily configure theSslContextBuilder
that will be applied to the SSL session. -
addressResolverGroupFactory
public Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>> addressResolverGroupFactory()Returns the factory that creates anAddressResolverGroup
which resolves remote addresses intoInetSocketAddress
es. -
http2InitialConnectionWindowSize
public int http2InitialConnectionWindowSize()Returns the HTTP/2 initial connection flow-control window size. -
http2InitialStreamWindowSize
public int http2InitialStreamWindowSize()Returns the SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control. -
http2MaxFrameSize
public int http2MaxFrameSize()Returns the SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive. -
http2MaxHeaderListSize
public long http2MaxHeaderListSize()Returns the HTTP/2 SETTINGS_MAX_HEADER_LIST_SIZE that indicates the maximum size of header list that the client is prepared to accept, in octets. -
http1MaxInitialLineLength
public int http1MaxInitialLineLength()Returns the maximum length of an HTTP/1 response initial line. -
http1MaxHeaderSize
public int http1MaxHeaderSize()Returns the maximum length of all headers in an HTTP/1 response. -
http1MaxChunkSize
public int http1MaxChunkSize()Returns the maximum length of each chunk in an HTTP/1 response content. -
idleTimeoutMillis
public long idleTimeoutMillis()Returns the idle timeout of a socket connection in milliseconds. -
pingIntervalMillis
public long pingIntervalMillis() -
maxConnectionAgeMillis
public long maxConnectionAgeMillis()Returns the client-side max age of a connection for keep-alive in milliseconds. If the value is greater than0
, a connection is disconnected after the specified amount of the time since the connection was established. -
maxNumRequestsPerConnection
public int maxNumRequestsPerConnection()Returns the client-side maximum allowed number of requests that can be sent through one connection. -
useHttp2Preface
public boolean useHttp2Preface()Returns whether to send an HTTP/2 preface string instead of an HTTP/1 upgrade request to negotiate the protocol version of a cleartext HTTP connection. -
useHttp1Pipelining
public boolean useHttp1Pipelining()Returns whether to use HTTP pipelining for HTTP/1 connections. -
connectionPoolListener
Returns the listener which is notified on a connection pool event. -
meterRegistry
Returns theMeterRegistry
which collects various stats. -
proxyConfigSelector
TheProxyConfigSelector
which determines theProxyConfig
to be used. -
http1HeaderNaming
Returns theHttp1HeaderNaming
which converts a lower-cased HTTP/2 header name into another header name. This is useful when communicating with a legacy system that only supports case sensitive HTTP/1 headers. -
tlsAllowUnsafeCiphers
public boolean tlsAllowUnsafeCiphers()Returns whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.Note that enabling this option increases the security risk of your connection. Use it only when you must communicate with a legacy system that does not support secure cipher suites. See Section 9.2.2, RFC7540 for more information.
-