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()
AsyncReadBinding
getReadPreference
in interface AsyncReadBinding
public void getWriteConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
AsyncWriteBinding
getWriteConnectionSource
in interface AsyncWriteBinding
callback
- the to be passed the connection sourcepublic SessionContext getSessionContext()
AsyncReadBinding
getSessionContext
in interface AsyncReadBinding
getSessionContext
in interface AsyncWriteBinding
public void getReadConnectionSource(SingleResultCallback<AsyncConnectionSource> callback)
AsyncReadBinding
getReadConnectionSource
in interface AsyncReadBinding
callback
- the to be passed the connection sourcepublic int getCount()
ReferenceCounted
getCount
in interface ReferenceCounted
public AsyncReadWriteBinding retain()
ReferenceCounted
retain
in interface AsyncReadBinding
retain
in interface AsyncReadWriteBinding
retain
in interface AsyncWriteBinding
retain
in interface ReferenceCounted
public void release()
ReferenceCounted
release
in interface ReferenceCounted
private void closeSessionIfCountIsZero()