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
ClientFactoryOptions and their respective values.-
Field Summary
Fields Modifier and Type Field Description static ClientFactoryOption<Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>>>ADDRESS_RESOLVER_GROUP_FACTORYThe factory that creates anAddressResolverGroupwhich resolves remote addresses intoInetSocketAddresses.static ClientFactoryOption<Map<ChannelOption<?>,Object>>CHANNEL_OPTIONSTheChannelOptions of the sockets created by theClientFactory.static ClientFactoryOption<ConnectionPoolListener>CONNECTION_POOL_LISTENERThe listener which is notified on a connection pool event.static ClientFactoryOption<Function<? super EventLoopGroup,? extends EventLoopScheduler>>EVENT_LOOP_SCHEDULER_FACTORYThe factory that creates anEventLoopSchedulerwhich is responsible for assigning anEventLoopto handle a connection to the specifiedEndpoint.static ClientFactoryOption<Http1HeaderNaming>HTTP1_HEADER_NAMINGTheHttp1HeaderNamingwhich converts a lower-cased HTTP/2 header name into another HTTP/1 header name.static ClientFactoryOption<Integer>HTTP1_MAX_CHUNK_SIZEThe maximum length of each chunk in an HTTP/1 response content.static ClientFactoryOption<Integer>HTTP1_MAX_HEADER_SIZEThe maximum length of all headers in an HTTP/1 response.static ClientFactoryOption<Integer>HTTP1_MAX_INITIAL_LINE_LENGTHThe maximum length of an HTTP/1 response initial line.static ClientFactoryOption<Integer>HTTP2_INITIAL_CONNECTION_WINDOW_SIZEThe HTTP/2 initial connection flow-control window size.static ClientFactoryOption<Integer>HTTP2_INITIAL_STREAM_WINDOW_SIZEThe SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.static ClientFactoryOption<Integer>HTTP2_MAX_FRAME_SIZEThe 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_SIZEThe 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_MILLISThe idle timeout of a socket connection in milliseconds.static ClientFactoryOption<Long>MAX_CONNECTION_AGE_MILLISThe client-side max age of a connection for keep-alive in milliseconds.static ClientFactoryOption<Integer>MAX_NUM_REQUESTS_PER_CONNECTIONThe client-side maximum allowed number of requests that can be sent through one connection.static ClientFactoryOption<MeterRegistry>METER_REGISTRYTheMeterRegistrywhich collects various stats.static ClientFactoryOption<Long>PING_INTERVAL_MILLISThe PING interval in milliseconds.static ClientFactoryOption<ProxyConfigSelector>PROXY_CONFIG_SELECTORTheProxyConfigSelectorwhich determines theProxyConfigto be used.static ClientFactoryOption<Boolean>SHUTDOWN_WORKER_GROUP_ON_CLOSEWhether to shut down the workerEventLoopGroupwhen theClientFactoryis closed.static ClientFactoryOption<Boolean>TLS_ALLOW_UNSAFE_CIPHERSDeprecated.It's not recommended to enable this option.static ClientFactoryOption<Consumer<? super SslContextBuilder>>TLS_CUSTOMIZERTheConsumerwhich can arbitrarily configure theSslContextBuilderthat will be applied to the SSL session.static ClientFactoryOption<Boolean>USE_HTTP1_PIPELININGWhether to use HTTP pipelining for HTTP/1 connections.static ClientFactoryOption<Boolean>USE_HTTP2_PREFACEWhether 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_GROUPThe workerEventLoopGroup. -
Method Summary
Modifier and Type Method Description Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>>addressResolverGroupFactory()Returns the factory that creates anAddressResolverGroupwhich resolves remote addresses intoInetSocketAddresses.Map<ChannelOption<?>,Object>channelOptions()Returns theChannelOptions of the sockets created by theClientFactory.ConnectionPoolListenerconnectionPoolListener()Returns the listener which is notified on a connection pool event.Function<? super EventLoopGroup,? extends EventLoopScheduler>eventLoopSchedulerFactory()Returns the factory that creates anEventLoopSchedulerwhich is responsible for assigning anEventLoopto handle a connection to the specifiedEndpoint.Http1HeaderNaminghttp1HeaderNaming()Returns theHttp1HeaderNamingwhich converts a lower-cased HTTP/2 header name into another header name.inthttp1MaxChunkSize()Returns the maximum length of each chunk in an HTTP/1 response content.inthttp1MaxHeaderSize()Returns the maximum length of all headers in an HTTP/1 response.inthttp1MaxInitialLineLength()Returns the maximum length of an HTTP/1 response initial line.inthttp2InitialConnectionWindowSize()Returns the HTTP/2 initial connection flow-control window size.inthttp2InitialStreamWindowSize()Returns the SETTINGS_INITIAL_WINDOW_SIZE for HTTP/2 stream-level flow control.inthttp2MaxFrameSize()Returns the SETTINGS_MAX_FRAME_SIZE that indicates the size of the largest frame payload that this client is willing to receive.longhttp2MaxHeaderListSize()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.longidleTimeoutMillis()Returns the idle timeout of a socket connection in milliseconds.longmaxConnectionAgeMillis()Returns the client-side max age of a connection for keep-alive in milliseconds.intmaxNumRequestsPerConnection()Returns the client-side maximum allowed number of requests that can be sent through one connection.MeterRegistrymeterRegistry()Returns theMeterRegistrywhich collects various stats.static ClientFactoryOptionsof()Returns an empty singletonClientFactoryOptions.static ClientFactoryOptionsof(ClientFactoryOptions baseOptions, ClientFactoryOptionValue<?>... additionalValues)Merges the specifiedClientFactoryOptionsandClientFactoryOptionValues.static ClientFactoryOptionsof(ClientFactoryOptions baseOptions, Iterable<? extends ClientFactoryOptionValue<?>> additionalValues)Merges the specifiedClientFactoryOptionsandClientFactoryOptionValues.static ClientFactoryOptionsof(ClientFactoryOptionValue<?>... values)Returns theClientFactoryOptionswith the specifiedClientFactoryOptionValues.static ClientFactoryOptionsof(Iterable<? extends ClientFactoryOptionValue<?>> values)Returns theClientFactoryOptionswith the specifiedClientFactoryOptionValues.longpingIntervalMillis()Returns the PING interval in milliseconds.ProxyConfigSelectorproxyConfigSelector()TheProxyConfigSelectorwhich determines theProxyConfigto be used.booleanshutdownWorkerGroupOnClose()Returns the flag whether to shut down the workerEventLoopGroupwhen theClientFactoryis closed.booleantlsAllowUnsafeCiphers()Returns whether to allow the bad cipher suites listed in RFC7540 for TLS handshake.Consumer<? super SslContextBuilder>tlsCustomizer()Returns theConsumerwhich can arbitrarily configure theSslContextBuilderthat will be applied to the SSL session.booleanuseHttp1Pipelining()Returns whether to use HTTP pipelining for HTTP/1 connections.booleanuseHttp2Preface()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.EventLoopGroupworkerGroup()Returns the workerEventLoopGroup.Methods inherited from class com.linecorp.armeria.common.util.AbstractOptions
asMap, get, iterator, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
WORKER_GROUP
The workerEventLoopGroup. -
SHUTDOWN_WORKER_GROUP_ON_CLOSE
Whether to shut down the workerEventLoopGroupwhen theClientFactoryis closed. -
EVENT_LOOP_SCHEDULER_FACTORY
public static final ClientFactoryOption<Function<? super EventLoopGroup,? extends EventLoopScheduler>> EVENT_LOOP_SCHEDULER_FACTORYThe factory that creates anEventLoopSchedulerwhich is responsible for assigning anEventLoopto handle a connection to the specifiedEndpoint. -
TLS_CUSTOMIZER
TheConsumerwhich can arbitrarily configure theSslContextBuilderthat 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 anAddressResolverGroupwhich resolves remote addresses intoInetSocketAddresses. -
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
TheMeterRegistrywhich collects various stats. -
PROXY_CONFIG_SELECTOR
TheProxyConfigSelectorwhich determines theProxyConfigto be used. -
HTTP1_HEADER_NAMING
TheHttp1HeaderNamingwhich converts a lower-cased HTTP/2 header name into another HTTP/1 header name. -
CHANNEL_OPTIONS
TheChannelOptions of the sockets created by theClientFactory.
-
-
Method Details
-
of
Returns an empty singletonClientFactoryOptions. -
of
Returns theClientFactoryOptionswith the specifiedClientFactoryOptionValues. -
of
Returns theClientFactoryOptionswith the specifiedClientFactoryOptionValues. -
of
public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, ClientFactoryOptionValue<?>... additionalValues)Merges the specifiedClientFactoryOptionsandClientFactoryOptionValues.- Returns:
- the merged
ClientFactoryOptions
-
of
public static ClientFactoryOptions of(ClientFactoryOptions baseOptions, Iterable<? extends ClientFactoryOptionValue<?>> additionalValues)Merges the specifiedClientFactoryOptionsandClientFactoryOptionValues.- Returns:
- the merged
ClientFactoryOptions
-
workerGroup
Returns the workerEventLoopGroup. -
shutdownWorkerGroupOnClose
public boolean shutdownWorkerGroupOnClose()Returns the flag whether to shut down the workerEventLoopGroupwhen theClientFactoryis closed. -
eventLoopSchedulerFactory
Returns the factory that creates anEventLoopSchedulerwhich is responsible for assigning anEventLoopto handle a connection to the specifiedEndpoint. -
channelOptions
Returns theChannelOptions of the sockets created by theClientFactory. -
tlsCustomizer
Returns theConsumerwhich can arbitrarily configure theSslContextBuilderthat will be applied to the SSL session. -
addressResolverGroupFactory
public Function<? super EventLoopGroup,? extends AddressResolverGroup<? extends InetSocketAddress>> addressResolverGroupFactory()Returns the factory that creates anAddressResolverGroupwhich resolves remote addresses intoInetSocketAddresses. -
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 theMeterRegistrywhich collects various stats. -
proxyConfigSelector
TheProxyConfigSelectorwhich determines theProxyConfigto be used. -
http1HeaderNaming
Returns theHttp1HeaderNamingwhich 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.
-