U - the service interface typepublic final class ThriftClientConnectionPool<U>
extends java.lang.Object
implements java.io.Closeable
| Constructor and Description |
|---|
ThriftClientConnectionPool(ThriftClientConnectionPoolConfig<?,U> config)
Initialize a new connection pool with the specified configuration.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the connection pool.
|
org.apache.thrift.transport.TTransport |
getTransport(com.google.common.net.HostAndPort hostAndPort)
Get a connection to the remote Nifty endpoint identified by the given hostname & port.
|
org.apache.thrift.transport.TTransport |
getTransport(com.google.common.net.HostAndPort hostAndPort,
java.time.Duration timeout)
Get a connection to the remote Nifty endpoint identified by the given hostname & port
and borrow timeout.
|
org.apache.thrift.transport.TTransport |
getTransport(java.net.InetSocketAddress socketAddress)
Get a connection to the remote Nifty endpoint identified by the given hostname & port
and borrow timeout.
|
org.apache.thrift.transport.TTransport |
getTransport(java.net.InetSocketAddress socketAddress,
java.time.Duration timeout)
Get a connection to the remote Nifty endpoint identified by the given socket address
and borrow timeout.
|
org.apache.thrift.transport.TTransport |
getTransport(java.lang.String host,
int port)
Get a connection to the remote Nifty endpoint identified by the given hostname/IP & port.
|
public ThriftClientConnectionPool(ThriftClientConnectionPoolConfig<?,U> config)
config - the connection pool configurationpublic void close()
Note that this does not automatically close all borrowed connections.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablepublic org.apache.thrift.transport.TTransport getTransport(java.lang.String host,
int port)
throws java.lang.Exception
host - the hostname or IP of the remote hostport - the remote portjava.lang.Exceptionpublic org.apache.thrift.transport.TTransport getTransport(com.google.common.net.HostAndPort hostAndPort)
throws java.lang.Exception
hostAndPort - the hostname/IP and port of the remote endpointjava.lang.Exceptionpublic org.apache.thrift.transport.TTransport getTransport(com.google.common.net.HostAndPort hostAndPort,
java.time.Duration timeout)
throws java.lang.Exception
hostAndPort - the remote hostname/IP and port of the remote endpointtimeout - the borrow timeoutjava.lang.Exceptionpublic org.apache.thrift.transport.TTransport getTransport(java.net.InetSocketAddress socketAddress)
throws java.lang.Exception
socketAddress - the remote hostname/IP and port of the remote endpointjava.lang.Exceptionpublic org.apache.thrift.transport.TTransport getTransport(java.net.InetSocketAddress socketAddress,
java.time.Duration timeout)
throws java.lang.Exception
socketAddress - the remote socket addresstimeout - the borrow timeoutjava.lang.Exception