public class ThriftServerConfig extends Object
| Constructor and Description |
|---|
ThriftServerConfig() |
| Modifier and Type | Method and Description |
|---|---|
int |
getAcceptBacklog() |
int |
getAcceptorThreadCount() |
String |
getBindAddress() |
int |
getConnectionLimit() |
io.airlift.units.Duration |
getIdleConnectionTimeout() |
int |
getIoThreadCount() |
io.airlift.units.DataSize |
getMaxFrameSize() |
Integer |
getMaxQueuedRequests() |
ExecutorService |
getOrBuildWorkerExecutor(Map<String,ExecutorService> boundWorkerExecutors)
Builds the
ExecutorService used for running Thrift server methods. |
int |
getPort() |
String |
getProtocolName() |
io.airlift.units.Duration |
getTaskExpirationTimeout() |
String |
getTransportName() |
String |
getWorkerExecutorKey() |
int |
getWorkerThreads() |
ThriftServerConfig |
setAcceptBacklog(int acceptBacklog)
Sets the number of pending connections that the
ServerSocket will
queue up before the server process can actually accept them. |
ThriftServerConfig |
setAcceptorThreadCount(int acceptorThreadCount) |
ThriftServerConfig |
setBindAddress(String bindAddress) |
ThriftServerConfig |
setConnectionLimit(int connectionLimit)
Sets an upper bound on the number of concurrent connections the server will accept.
|
ThriftServerConfig |
setIdleConnectionTimeout(io.airlift.units.Duration idleConnectionTimeout)
Sets a timeout period between receiving requests from a client connection.
|
ThriftServerConfig |
setIoThreadCount(int ioThreadCount) |
ThriftServerConfig |
setMaxFrameSize(io.airlift.units.DataSize maxFrameSize)
Sets a maximum frame size
|
ThriftServerConfig |
setMaxQueuedRequests(Integer maxQueuedRequests) |
ThriftServerConfig |
setPort(int port) |
ThriftServerConfig |
setProtocolName(String protocolName)
Sets the name of the protocol that this server will speak.
|
ThriftServerConfig |
setTaskExpirationTimeout(io.airlift.units.Duration taskExpirationTimeout)
Sets a timeout period between receiving a request and the completion of that request.
|
ThriftServerConfig |
setTransportName(String transportName)
Sets the name of the transport (frame codec) that this server will handle.
|
ThriftServerConfig |
setWorkerExecutor(ExecutorService workerExecutor)
Sets the executor that will be used to process thrift requests after they arrive.
|
ThriftServerConfig |
setWorkerExecutorKey(String workerExecutorKey)
Sets the key for locating an
ExecutorService from the
mapped executors installed by Guice modules. |
ThriftServerConfig |
setWorkerThreads(int workerThreads)
Sets the number of worker threads that will be created for processing thrift requests after
they have arrived.
|
public String getBindAddress()
@Config(value="thrift.bind-address") public ThriftServerConfig setBindAddress(String bindAddress)
@Min(value=0L) @Max(value=65535L) public int getPort()
@Config(value="thrift.port") public ThriftServerConfig setPort(int port)
public io.airlift.units.DataSize getMaxFrameSize()
@Config(value="thrift.max-frame-size") public ThriftServerConfig setMaxFrameSize(io.airlift.units.DataSize maxFrameSize)
maxFrameSize - @Config(value="thrift.accept-backlog") public ThriftServerConfig setAcceptBacklog(int acceptBacklog)
ServerSocket will
queue up before the server process can actually accept them. If your server may take a lot
of connections in a very short interval, you'll want to set this higher to avoid rejecting
some of the connections. Setting this to 0 will apply an implementation-specific default.
The default value is 1024.
Actual behavior of the socket backlog is dependent on OS and JDK implementation, and it may
even be ignored on some systems. See JDK docs
here
for details.acceptBacklog - @Min(value=0L) public int getAcceptBacklog()
public int getAcceptorThreadCount()
@Config(value="thrift.acceptor-threads.count") public ThriftServerConfig setAcceptorThreadCount(int acceptorThreadCount)
public int getIoThreadCount()
@Config(value="thrift.io-threads.count") public ThriftServerConfig setIoThreadCount(int ioThreadCount)
public io.airlift.units.Duration getIdleConnectionTimeout()
@Config(value="thrift.idle-connection-timeout") public ThriftServerConfig setIdleConnectionTimeout(io.airlift.units.Duration idleConnectionTimeout)
idleConnectionTimeout - The timeoutThriftServerConfig instancepublic io.airlift.units.Duration getTaskExpirationTimeout()
@Config(value="thrift.task-expiration-timeout") public ThriftServerConfig setTaskExpirationTimeout(io.airlift.units.Duration taskExpirationTimeout)
taskExpirationTimeout - The timeoutThriftServerConfig instance@Min(value=0L) public int getConnectionLimit()
@Config(value="thrift.connection-limit") public ThriftServerConfig setConnectionLimit(int connectionLimit)
connectionLimit - The maximum number of concurrent connectionsThriftServerConfig instance@Min(value=1L) public int getWorkerThreads()
@Config(value="thrift.threads.max") public ThriftServerConfig setWorkerThreads(int workerThreads)
setWorkerExecutor(java.util.concurrent.ExecutorService) is called.
The default value is 200.workerThreads - Number of worker threads to useThriftServerConfig instancepublic String getWorkerExecutorKey()
@Config(value="thrift.worker-executor-key") public ThriftServerConfig setWorkerExecutorKey(String workerExecutorKey)
ExecutorService from the
mapped executors installed by Guice modules.
If you are not configuring your application usingGuice, it will probably be simpler to just
call this#setWorkerExecutor(java.util.concurrent.ExecutorService) instead.
Use of this method on a ThriftServerConfig instance is
incompatible with use of this#setWorkerExecutor(java.util.concurrent.ExecutorService)
or this#setWorkerThreads(int)public Integer getMaxQueuedRequests()
@Config(value="thrift.max-queued-requests") public ThriftServerConfig setMaxQueuedRequests(Integer maxQueuedRequests)
public ExecutorService getOrBuildWorkerExecutor(Map<String,ExecutorService> boundWorkerExecutors)
Builds the ExecutorService used for running Thrift server methods.
The details of the ExecutorService that gets built can be tweaked
by calling any of the following (though only one of these should actually be called):
this#setWorkerThreads(int)this#setWorkerExecutor(java.util.concurrent.ExecutorService)this#setWorkerExecutorKey(String)The default behavior if none of the above were called is to synthesize a fixed-size
ThreadPoolExecutor using this#DEFAULT_WORKER_THREAD_COUNT
threads.
public ThriftServerConfig setWorkerExecutor(ExecutorService workerExecutor)
setWorkerThreads(int).
Use of this method on a ThriftServerConfig instance is
incompatible with use of this#setWorkerExecutorKey(String) or
this#setWorkerThreads(int)workerExecutor - The worker executorThriftServerConfig instance@Config(value="thrift.transport") public ThriftServerConfig setTransportName(String transportName)
transportName - The name of the transportThriftServerConfig instance@NotNull public String getTransportName()
@Config(value="thrift.protocol") public ThriftServerConfig setProtocolName(String protocolName)
protocolName - The name of the protocolThriftServerConfig instance@NotNull public String getProtocolName()
Copyright © 2012–2015 Facebook, Inc.. All rights reserved.