Package org.apache.hadoop.hbase.thrift
Class TBoundedThreadPoolServer
java.lang.Object
org.apache.thrift.server.TServer
org.apache.hadoop.hbase.thrift.TBoundedThreadPoolServer
A bounded thread pool server customized for HBase.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
private final class
Nested classes/interfaces inherited from class org.apache.thrift.server.TServer
org.apache.thrift.server.TServer.AbstractServerArgs<T extends org.apache.thrift.server.TServer.AbstractServerArgs<T>>
-
Field Summary
Modifier and TypeFieldDescriptionprivate final CallQueue
static final int
static final int
static final int
This default core pool size should be enough for many test scenarios.private static final int
private ThreadPoolExecutor
Executor service for handling client connectionsprivate static final org.slf4j.Logger
static final String
The maximum number of pending connections waiting in the queue.static final String
The maximum size of the thread pool.static final String
The "core size" of the thread pool.private static final String
private TBoundedThreadPoolServer.Args
private boolean
Flag for stopping the serverstatic final String
Default amount of time in seconds to keep a thread alive.static final int
Time to wait after interrupting all worker threads.Fields inherited from class org.apache.thrift.server.TServer
eventHandler_, inputProtocolFactory_, inputTransportFactory_, outputProtocolFactory_, outputTransportFactory_, processorFactory_, serverTransport_, stopped_
-
Constructor Summary
ConstructorDescriptionTBoundedThreadPoolServer
(TBoundedThreadPoolServer.Args options, ThriftMetrics metrics) -
Method Summary
Modifier and TypeMethodDescriptionvoid
serve()
private void
Loop untilExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
finally does return without an interrupted exception.void
stop()
Methods inherited from class org.apache.thrift.server.TServer
getEventHandler, getShouldStop, isServing, setServerEventHandler, setServing, setShouldStop
-
Field Details
-
QUEUE_FULL_MSG
- See Also:
-
MIN_WORKER_THREADS_CONF_KEY
The "core size" of the thread pool. New threads are created on every connection until this many threads are created.- See Also:
-
DEFAULT_MIN_WORKER_THREADS
This default core pool size should be enough for many test scenarios. We want to override this with a much larger number (e.g. at least 200) for a large-scale production setup.- See Also:
-
MAX_WORKER_THREADS_CONF_KEY
The maximum size of the thread pool. When the pending request queue overflows, new threads are created until their number reaches this number. After that, the server starts dropping connections.- See Also:
-
DEFAULT_MAX_WORKER_THREADS
- See Also:
-
MAX_QUEUED_REQUESTS_CONF_KEY
The maximum number of pending connections waiting in the queue. If there are no idle threads in the pool, the server queues requests. Only when the queue overflows, new threads are added, up to hbase.thrift.maxQueuedRequests threads.- See Also:
-
DEFAULT_MAX_QUEUED_REQUESTS
- See Also:
-
THREAD_KEEP_ALIVE_TIME_SEC_CONF_KEY
Default amount of time in seconds to keep a thread alive. Worker threads are stopped after being idle for this long.- See Also:
-
DEFAULT_THREAD_KEEP_ALIVE_TIME_SEC
- See Also:
-
TIME_TO_WAIT_AFTER_SHUTDOWN_MS
Time to wait after interrupting all worker threads. This is after a clean shutdown has been attempted.- See Also:
-
LOG
-
callQueue
-
executorService
Executor service for handling client connections -
stopped
Flag for stopping the server -
serverOptions
-
-
Constructor Details
-
TBoundedThreadPoolServer
-
-
Method Details
-
serve
- Specified by:
serve
in classorg.apache.thrift.server.TServer
-
shutdownServer
Loop untilExecutorService.awaitTermination(long, java.util.concurrent.TimeUnit)
finally does return without an interrupted exception. If we don't do this, then we'll shut down prematurely. We want to let the executor service clear its task queue, closing client sockets appropriately. -
stop
- Overrides:
stop
in classorg.apache.thrift.server.TServer
-