public class ClientImpl extends java.lang.Object implements Client, Protocol.ProtocolEventListener
| Modifier and Type | Class and Description |
|---|---|
class |
ClientImpl.PooledXProtocol |
Client.ClientPropertyProtocol.ProtocolEventListener.EventType| Modifier and Type | Field and Description |
|---|---|
(package private) java.util.Set<java.lang.ref.WeakReference<ClientImpl.PooledXProtocol>> |
activeProtocols |
private ConnectionUrl |
connUrl |
(package private) java.util.Map<HostInfo,java.lang.Long> |
demotedHosts |
private int |
demotedTimeout |
(package private) java.util.concurrent.BlockingQueue<ClientImpl.PooledXProtocol> |
idleProtocols |
(package private) boolean |
isClosed |
(package private) int |
maxIdleTime |
private int |
maxSize |
(package private) java.util.Set<java.lang.ref.WeakReference<Session>> |
nonPooledSessions |
private boolean |
poolingEnabled |
private int |
queueTimeout |
(package private) SessionFactory |
sessionFactory |
| Constructor and Description |
|---|
ClientImpl(java.lang.String url,
java.util.Properties clientProps) |
ClientImpl(java.lang.String url,
java.lang.String clientPropsJson) |
| Modifier and Type | Method and Description |
|---|---|
private java.util.Properties |
clientPropsFromJson(java.lang.String clientPropsJson) |
void |
close()
Close
Client. |
Session |
getSession()
Get
Session from pool or the new one. |
void |
handleEvent(Protocol.ProtocolEventListener.EventType type,
java.lang.Object info,
java.lang.Throwable reason) |
(package private) void |
idleProtocol(ClientImpl.PooledXProtocol prot) |
private void |
init(java.lang.String url,
java.util.Properties clientProps) |
private ClientImpl.PooledXProtocol |
newPooledXProtocol(HostInfo hi) |
private void |
removeActivePooledXProtocol(ClientImpl.PooledXProtocol prot) |
private void |
validateAndInitializeClientProps(java.util.Properties clientProps) |
boolean isClosed
private ConnectionUrl connUrl
private boolean poolingEnabled
private int maxSize
int maxIdleTime
private int queueTimeout
private int demotedTimeout
java.util.Map<HostInfo,java.lang.Long> demotedHosts
java.util.concurrent.BlockingQueue<ClientImpl.PooledXProtocol> idleProtocols
java.util.Set<java.lang.ref.WeakReference<ClientImpl.PooledXProtocol>> activeProtocols
java.util.Set<java.lang.ref.WeakReference<Session>> nonPooledSessions
SessionFactory sessionFactory
public ClientImpl(java.lang.String url,
java.lang.String clientPropsJson)
public ClientImpl(java.lang.String url,
java.util.Properties clientProps)
private java.util.Properties clientPropsFromJson(java.lang.String clientPropsJson)
private void validateAndInitializeClientProps(java.util.Properties clientProps)
private void init(java.lang.String url,
java.util.Properties clientProps)
public Session getSession()
ClientSession from pool or the new one.getSession in interface ClientSessionprivate ClientImpl.PooledXProtocol newPooledXProtocol(HostInfo hi)
public void close()
ClientClient.
Closes all Sessions it has created, and destroys the managed pool.
Calling the method close on a Client
object that is already closed is a no-op.
void idleProtocol(ClientImpl.PooledXProtocol prot)
public void handleEvent(Protocol.ProtocolEventListener.EventType type, java.lang.Object info, java.lang.Throwable reason)
handleEvent in interface Protocol.ProtocolEventListenerprivate void removeActivePooledXProtocol(ClientImpl.PooledXProtocol prot)