public class TServerUtils extends Object
Modifier and Type | Field and Description |
---|---|
static ThreadLocal<String> |
clientAddress
Static instance, passed to
ClientInfoProcessorFactory , which will contain the client address of any incoming RPC. |
Constructor and Description |
---|
TServerUtils() |
Modifier and Type | Method and Description |
---|---|
static ServerAddress |
createBlockingServer(HostAndPort address,
org.apache.thrift.TProcessor processor,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
long maxMessageSize,
String serverName,
int numThreads,
int numSimpleTimerThreads,
long timeBetweenThreadChecks)
Creates a TTheadPoolServer for normal unsecure operation.
|
static ServerAddress |
createNonBlockingServer(HostAndPort address,
org.apache.thrift.TProcessor processor,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
String serverName,
String threadName,
int numThreads,
int numSTThreads,
long timeBetweenThreadChecks,
long maxMessageSize)
Create a NonBlockingServer with a custom thread pool that can dynamically resize itself.
|
static ServerAddress |
createSaslThreadPoolServer(HostAndPort address,
org.apache.thrift.TProcessor processor,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
long socketTimeout,
SaslServerConnectionParams params,
String serverName,
String threadName,
int numThreads,
int numSTThreads,
long timeBetweenThreadChecks) |
static ThreadPoolExecutor |
createSelfResizingThreadPool(String serverName,
int executorThreads,
int simpleTimerThreads,
long timeBetweenThreadChecks)
Creates a
SimpleThreadPool which uses SimpleTimer to inspect the core pool size and number of active threads of the
ThreadPoolExecutor and increase or decrease the core pool size based on activity (excessive or lack thereof). |
static ServerAddress |
createSslThreadPoolServer(HostAndPort address,
org.apache.thrift.TProcessor processor,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
long socketTimeout,
SslConnectionParams sslParams,
String serverName,
int numThreads,
int numSimpleTimerThreads,
long timeBetweenThreadChecks)
Create a Thrift SSL server.
|
static org.apache.thrift.server.TThreadPoolServer |
createTThreadPoolServer(org.apache.thrift.transport.TServerTransport transport,
org.apache.thrift.TProcessor processor,
org.apache.thrift.transport.TTransportFactory transportFactory,
org.apache.thrift.protocol.TProtocolFactory protocolFactory)
Create a
TThreadPoolServer with the provided transport, processor and transport factory. |
static org.apache.thrift.server.TThreadPoolServer |
createTThreadPoolServer(org.apache.thrift.transport.TServerTransport transport,
org.apache.thrift.TProcessor processor,
org.apache.thrift.transport.TTransportFactory transportFactory,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
ExecutorService service)
Create a
TThreadPoolServer with the provided server transport, processor and transport factory. |
static org.apache.thrift.transport.TServerSocket |
getSslServerSocket(int port,
int timeout,
InetAddress address,
SslConnectionParams params)
Create the Thrift server socket for RPC running over SSL.
|
static ServerAddress |
startServer(AccumuloServerContext service,
String hostname,
Property portHintProperty,
org.apache.thrift.TProcessor processor,
String serverName,
String threadName,
Property portSearchProperty,
Property minThreadProperty,
Property timeBetweenThreadChecksProperty,
Property maxMessageSizeProperty)
Start a server, at the given port, or higher, if that port is not available.
|
static ServerAddress |
startTServer(AccumuloConfiguration conf,
HostAndPort address,
ThriftServerType serverType,
org.apache.thrift.TProcessor processor,
String serverName,
String threadName,
int numThreads,
int numSTThreads,
long timeBetweenThreadChecks,
long maxMessageSize,
SslConnectionParams sslParams,
SaslServerConnectionParams saslParams,
long serverSocketTimeout) |
static ServerAddress |
startTServer(HostAndPort address,
ThriftServerType serverType,
TimedProcessor processor,
String serverName,
String threadName,
int numThreads,
int numSTThreads,
long timeBetweenThreadChecks,
long maxMessageSize,
SslConnectionParams sslParams,
SaslServerConnectionParams saslParams,
long serverSocketTimeout) |
static ServerAddress |
startTServer(HostAndPort address,
ThriftServerType serverType,
TimedProcessor processor,
org.apache.thrift.protocol.TProtocolFactory protocolFactory,
String serverName,
String threadName,
int numThreads,
int numSTThreads,
long timeBetweenThreadChecks,
long maxMessageSize,
SslConnectionParams sslParams,
SaslServerConnectionParams saslParams,
long serverSocketTimeout)
Start the appropriate Thrift server (SSL or non-blocking server) for the given parameters.
|
static void |
stopTServer(org.apache.thrift.server.TServer s)
Stop a Thrift TServer.
|
public static final ThreadLocal<String> clientAddress
ClientInfoProcessorFactory
, which will contain the client address of any incoming RPC.public static ServerAddress startServer(AccumuloServerContext service, String hostname, Property portHintProperty, org.apache.thrift.TProcessor processor, String serverName, String threadName, Property portSearchProperty, Property minThreadProperty, Property timeBetweenThreadChecksProperty, Property maxMessageSizeProperty) throws UnknownHostException
service
- RPC configurationportHintProperty
- the port to attempt to open, can be zero, meaning "any available port"processor
- the service to be startedserverName
- the name of the class that is providing the servicethreadName
- name this service's thread for better debuggingportSearchProperty
- A boolean Property to control if port-search should be used, or null to disableminThreadProperty
- A Property to control the minimum number of threads in the pooltimeBetweenThreadChecksProperty
- A Property to control the amount of time between checks to resize the thread poolmaxMessageSizeProperty
- A Property to control the maximum Thrift message size acceptedUnknownHostException
- when we don't know our own addresspublic static ServerAddress createNonBlockingServer(HostAndPort address, org.apache.thrift.TProcessor processor, org.apache.thrift.protocol.TProtocolFactory protocolFactory, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks, long maxMessageSize) throws org.apache.thrift.transport.TTransportException
org.apache.thrift.transport.TTransportException
public static ThreadPoolExecutor createSelfResizingThreadPool(String serverName, int executorThreads, int simpleTimerThreads, long timeBetweenThreadChecks)
SimpleThreadPool
which uses SimpleTimer
to inspect the core pool size and number of active threads of the
ThreadPoolExecutor
and increase or decrease the core pool size based on activity (excessive or lack thereof).serverName
- A name to describe the thrift server this executor will serviceexecutorThreads
- The maximum number of threads for the executorsimpleTimerThreads
- The numbers of threads used to get the SimpleTimer
instancetimeBetweenThreadChecks
- The amount of time, in millis, between attempts to resize the executor thread poolThreadPoolExecutor
which will resize itself automaticallypublic static ServerAddress createBlockingServer(HostAndPort address, org.apache.thrift.TProcessor processor, org.apache.thrift.protocol.TProtocolFactory protocolFactory, long maxMessageSize, String serverName, int numThreads, int numSimpleTimerThreads, long timeBetweenThreadChecks) throws org.apache.thrift.transport.TTransportException
address
- Address to bind toprocessor
- TProcessor for the servermaxMessageSize
- Maximum size of a Thrift message allowedorg.apache.thrift.transport.TTransportException
public static org.apache.thrift.server.TThreadPoolServer createTThreadPoolServer(org.apache.thrift.transport.TServerTransport transport, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, org.apache.thrift.protocol.TProtocolFactory protocolFactory)
TThreadPoolServer
with the provided transport, processor and transport factory.transport
- Server transportprocessor
- Processor implementationtransportFactory
- Transport factoryTThreadPoolServer
public static org.apache.thrift.server.TThreadPoolServer createTThreadPoolServer(org.apache.thrift.transport.TServerTransport transport, org.apache.thrift.TProcessor processor, org.apache.thrift.transport.TTransportFactory transportFactory, org.apache.thrift.protocol.TProtocolFactory protocolFactory, ExecutorService service)
TThreadPoolServer
with the provided server transport, processor and transport factory.transport
- TServerTransport for the serverprocessor
- TProcessor for the servertransportFactory
- TTransportFactory for the serverpublic static org.apache.thrift.transport.TServerSocket getSslServerSocket(int port, int timeout, InetAddress address, SslConnectionParams params) throws org.apache.thrift.transport.TTransportException
port
- Port of the server socket to bind totimeout
- Socket timeoutaddress
- Address to bind the socket toparams
- SSL parametersorg.apache.thrift.transport.TTransportException
public static ServerAddress createSslThreadPoolServer(HostAndPort address, org.apache.thrift.TProcessor processor, org.apache.thrift.protocol.TProtocolFactory protocolFactory, long socketTimeout, SslConnectionParams sslParams, String serverName, int numThreads, int numSimpleTimerThreads, long timeBetweenThreadChecks) throws org.apache.thrift.transport.TTransportException
address
- host and port to bind toprocessor
- TProcessor for the serversocketTimeout
- Socket timeoutsslParams
- SSL parametersorg.apache.thrift.transport.TTransportException
public static ServerAddress createSaslThreadPoolServer(HostAndPort address, org.apache.thrift.TProcessor processor, org.apache.thrift.protocol.TProtocolFactory protocolFactory, long socketTimeout, SaslServerConnectionParams params, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks) throws org.apache.thrift.transport.TTransportException
org.apache.thrift.transport.TTransportException
public static ServerAddress startTServer(AccumuloConfiguration conf, HostAndPort address, ThriftServerType serverType, org.apache.thrift.TProcessor processor, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks, long maxMessageSize, SslConnectionParams sslParams, SaslServerConnectionParams saslParams, long serverSocketTimeout) throws org.apache.thrift.transport.TTransportException
org.apache.thrift.transport.TTransportException
public static ServerAddress startTServer(HostAndPort address, ThriftServerType serverType, TimedProcessor processor, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks, long maxMessageSize, SslConnectionParams sslParams, SaslServerConnectionParams saslParams, long serverSocketTimeout) throws org.apache.thrift.transport.TTransportException
org.apache.thrift.transport.TTransportException
startTServer(HostAndPort, ThriftServerType, TimedProcessor, TProtocolFactory, String, String, int, int, long, long, SslConnectionParams,
SaslServerConnectionParams, long)
public static ServerAddress startTServer(HostAndPort address, ThriftServerType serverType, TimedProcessor processor, org.apache.thrift.protocol.TProtocolFactory protocolFactory, String serverName, String threadName, int numThreads, int numSTThreads, long timeBetweenThreadChecks, long maxMessageSize, SslConnectionParams sslParams, SaslServerConnectionParams saslParams, long serverSocketTimeout) throws org.apache.thrift.transport.TTransportException
org.apache.thrift.transport.TTransportException
public static void stopTServer(org.apache.thrift.server.TServer s)
s
- The TServer to stopCopyright © 2011–2018 The Apache Software Foundation. All rights reserved.