public class SingleServerBinding extends Object implements ReadWriteBinding
| Constructor and Description |
|---|
SingleServerBinding(Cluster cluster,
ServerAddress serverAddress)
Creates an instance, defaulting to
ReadPreference.primary() for reads. |
SingleServerBinding(Cluster cluster,
ServerAddress serverAddress,
ReadPreference readPreference)
Creates an instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getCount()
Gets the current reference count, which starts at 0.
|
ConnectionSource |
getReadConnectionSource()
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.
|
ConnectionSource |
getWriteConnectionSource()
Supply a connection source to a server that can be written to
|
void |
release()
Release a reference to this object.
|
SingleServerBinding |
retain()
Retain an additional reference to this object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCount, releasepublic SingleServerBinding(Cluster cluster, ServerAddress serverAddress)
ReadPreference.primary() for reads.cluster - a non-null Cluster which will be used to select a server to bind toserverAddress - a non-null address of the server to bind topublic SingleServerBinding(Cluster cluster, ServerAddress serverAddress, ReadPreference readPreference)
cluster - a non-null Cluster which will be used to select a server to bind toserverAddress - a non-null address of the server to bind toreadPreference - a non-null ReadPreference for read operationspublic ConnectionSource getWriteConnectionSource()
WriteBindinggetWriteConnectionSource in interface WriteBindingpublic ReadPreference getReadPreference()
ReadBindinggetReadPreference in interface ReadBindingpublic ConnectionSource getReadConnectionSource()
ReadBindinggetReadConnectionSource in interface ReadBindingpublic SingleServerBinding retain()
ReferenceCountedretain in interface ReadBindingretain in interface ReadWriteBindingretain in interface ReferenceCountedretain in interface WriteBindingpublic int getCount()
ReferenceCountedgetCount in interface ReferenceCountedpublic void release()
ReferenceCountedrelease in interface ReferenceCounted