class ClientSessionBinding extends java.lang.Object implements AsyncReadWriteBinding
| Modifier and Type | Class and Description |
|---|---|
private class |
ClientSessionBinding.SessionBindingAsyncConnectionSource |
| Modifier and Type | Field and Description |
|---|---|
private boolean |
ownsSession |
private ClientSession |
session |
private ClientSessionContext |
sessionContext |
private AsyncReadWriteBinding |
wrapped |
| Constructor and Description |
|---|
ClientSessionBinding(ClientSession session,
boolean ownsSession,
AsyncReadWriteBinding wrapped) |
| Modifier and Type | Method and Description |
|---|---|
private void |
closeSessionIfCountIsZero() |
int |
getCount()
Gets the current reference count, which starts at 0.
|
void |
getReadConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
Returns a connection source to a server that satisfies the specified read preference.
|
ReadPreference |
getReadPreference()
The read preference that all connection sources returned by this instance will satisfy.
|
SessionContext |
getSessionContext()
Gets the session context for this binding.
|
void |
getWriteConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
Supply a connection source to a server that can be written to
|
void |
release()
Release a reference to this object.
|
AsyncReadWriteBinding |
retain()
Retain an additional reference to this object.
|
private final AsyncReadWriteBinding wrapped
private final ClientSession session
private final boolean ownsSession
private final ClientSessionContext sessionContext
ClientSessionBinding(ClientSession session, boolean ownsSession, AsyncReadWriteBinding wrapped)
public ReadPreference getReadPreference()
AsyncReadBindinggetReadPreference in interface AsyncReadBindingpublic void getWriteConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
AsyncWriteBindinggetWriteConnectionSource in interface AsyncWriteBindingcallback - the to be passed the connection sourcepublic SessionContext getSessionContext()
AsyncReadBindinggetSessionContext in interface AsyncReadBindinggetSessionContext in interface AsyncWriteBindingpublic void getReadConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
AsyncReadBindinggetReadConnectionSource in interface AsyncReadBindingcallback - the to be passed the connection sourcepublic int getCount()
ReferenceCountedgetCount in interface ReferenceCountedpublic AsyncReadWriteBinding retain()
ReferenceCountedretain in interface AsyncReadBindingretain in interface AsyncReadWriteBindingretain in interface AsyncWriteBindingretain in interface ReferenceCountedpublic void release()
ReferenceCountedrelease in interface ReferenceCountedprivate void closeSessionIfCountIsZero()