public static class GrizzlyThriftClient.Builder<T extends org.apache.thrift.TServiceClient> extends Object implements ThriftClientBuilder
| Constructor and Description |
|---|
Builder(String thriftClientName,
GrizzlyThriftClientManager manager,
org.glassfish.grizzly.nio.transport.TCPNIOTransport transport,
org.apache.thrift.TServiceClientFactory<T> clientFactory) |
| Modifier and Type | Method and Description |
|---|---|
GrizzlyThriftClient.Builder<T> |
allowDisposableConnection(boolean allowDisposableConnection)
Allow or disallow disposable connections
|
GrizzlyThriftClient.Builder<T> |
borrowValidation(boolean borrowValidation)
Enable or disable the connection validation when the connection is borrowed from the connection pool
|
GrizzlyThriftClient<T> |
build()
Create an instance of the named
ThriftClient. |
GrizzlyThriftClient.Builder<T> |
connectTimeoutInMillis(long connectTimeoutInMillis)
Set global connect-timeout
|
GrizzlyThriftClient.Builder<T> |
failover(boolean failover)
Enable or disable failover/failback
|
GrizzlyThriftClient.Builder<T> |
healthMonitorIntervalInSecs(long healthMonitorIntervalInSecs)
Set health monitor's interval
|
GrizzlyThriftClient.Builder<T> |
httpHeader(org.glassfish.grizzly.http.util.Header header,
String value) |
GrizzlyThriftClient.Builder<T> |
httpHeader(String name,
String value) |
GrizzlyThriftClient.Builder<T> |
httpUriPath(String httpUriPath) |
GrizzlyThriftClient.Builder<T> |
keepAliveTimeoutInSecs(long keepAliveTimeoutInSecs)
Set connection pool's KeepAliveTimeout
|
GrizzlyThriftClient.Builder<T> |
maxConnectionPerServer(int maxConnectionPerServer)
Set connection pool's max
|
GrizzlyThriftClient.Builder |
maxThriftFrameLength(int maxThriftFrameLength)
Set the max length of thrift frame
|
GrizzlyThriftClient.Builder<T> |
minConnectionPerServer(int minConnectionPerServer)
Set connection pool's min
|
GrizzlyThriftClient.Builder<T> |
responseTimeoutInMillis(long responseTimeoutInMillis)
Set global response-timeout
|
GrizzlyThriftClient.Builder<T> |
retainLastServer(boolean retainLastServer)
Enable or disable the keeping a server in the the round-robin list when the only one server is remained in the list.
|
GrizzlyThriftClient.Builder<T> |
retryCount(int retryCount)
Set retry count for connection or sending
|
GrizzlyThriftClient.Builder<T> |
returnValidation(boolean returnValidation)
Enable or disable the connection validation when the connection is returned to the connection pool
|
GrizzlyThriftClient.Builder<T> |
servers(Set<SocketAddress> servers)
Set initial servers
|
GrizzlyThriftClient.Builder<T> |
thriftProtocol(ThriftProtocols thriftProtocol) |
GrizzlyThriftClient.Builder<T> |
validationCheckMethodName(String validationCheckMethodName) |
GrizzlyThriftClient.Builder<T> |
writeTimeoutInMillis(long writeTimeoutInMillis)
Set global write-timeout
|
public Builder(String thriftClientName, GrizzlyThriftClientManager manager, org.glassfish.grizzly.nio.transport.TCPNIOTransport transport, org.apache.thrift.TServiceClientFactory<T> clientFactory)
public GrizzlyThriftClient<T> build()
ThriftClient.build in interface ThriftClientBuilderThriftClientManager.createThriftClientBuilder(String, org.apache.thrift.TServiceClientFactory)public GrizzlyThriftClient.Builder<T> connectTimeoutInMillis(long connectTimeoutInMillis)
If the given param is negative, the timeout is infite. Default is 5000.
connectTimeoutInMillis - connect-timeout in milli-secondspublic GrizzlyThriftClient.Builder<T> writeTimeoutInMillis(long writeTimeoutInMillis)
If the given param is negative, the timeout is infite. Default is 5000.
writeTimeoutInMillis - write-timeout in milli-secondspublic GrizzlyThriftClient.Builder<T> responseTimeoutInMillis(long responseTimeoutInMillis)
If the given param is negative, the timeout is infite. Default is 10000.
responseTimeoutInMillis - response-timeout in milli-secondspublic GrizzlyThriftClient.Builder<T> minConnectionPerServer(int minConnectionPerServer)
Default is 5.
minConnectionPerServer - connection pool's minBaseObjectPool.Builder#min(int)public GrizzlyThriftClient.Builder<T> maxConnectionPerServer(int maxConnectionPerServer)
Default is Integer.MAX_VALUE
maxConnectionPerServer - connection pool's maxBaseObjectPool.Builder#max(int)public GrizzlyThriftClient.Builder<T> keepAliveTimeoutInSecs(long keepAliveTimeoutInSecs)
Default is 1800.
keepAliveTimeoutInSecs - connection pool's KeepAliveTimeout in secondsBaseObjectPool.Builder#keepAliveTimeoutInSecs(long)public GrizzlyThriftClient.Builder<T> healthMonitorIntervalInSecs(long healthMonitorIntervalInSecs)
This thrift client will schedule HealthMonitorTask with this interval.
HealthMonitorTask will check the failure servers periodically and detect the revived server.
If the given parameter is negative, this thrift client never schedules HealthMonitorTask
so this behavior is similar to seting failover to be false.
Default is 60.
healthMonitorIntervalInSecs - interval in secondspublic GrizzlyThriftClient.Builder<T> allowDisposableConnection(boolean allowDisposableConnection)
Default is false.
allowDisposableConnection - true if this thrift client allows disposable connectionspublic GrizzlyThriftClient.Builder<T> borrowValidation(boolean borrowValidation)
Default is false.
borrowValidation - true if this thrift client should make sure the borrowed connection is validpublic GrizzlyThriftClient.Builder<T> returnValidation(boolean returnValidation)
Default is false.
returnValidation - true if this thrift client should make sure the returned connection is validpublic GrizzlyThriftClient.Builder<T> retainLastServer(boolean retainLastServer)
Default is false
retainLastServer - true if this thrift client should make sure the retaining one server in the round-robin list.public GrizzlyThriftClient.Builder<T> servers(Set<SocketAddress> servers)
servers - server setpublic GrizzlyThriftClient.Builder<T> failover(boolean failover)
Default is true.
failover - true if this thrift client should support failover/failback when the server is failed or revivedpublic GrizzlyThriftClient.Builder<T> retryCount(int retryCount)
Default is 1.
retryCount - the count for retrialspublic GrizzlyThriftClient.Builder<T> thriftProtocol(ThriftProtocols thriftProtocol)
public GrizzlyThriftClient.Builder maxThriftFrameLength(int maxThriftFrameLength)
maxThriftFrameLength - max frame lengthpublic GrizzlyThriftClient.Builder<T> httpUriPath(String httpUriPath)
public GrizzlyThriftClient.Builder<T> httpHeader(org.glassfish.grizzly.http.util.Header header, String value)
public GrizzlyThriftClient.Builder<T> httpHeader(String name, String value)
public GrizzlyThriftClient.Builder<T> validationCheckMethodName(String validationCheckMethodName)
Copyright © 2017-2019 Oracle Corporation. All Rights Reserved.