public class ClusterBinding extends Object implements ReadWriteBinding
Constructor and Description |
---|
ClusterBinding(Cluster cluster,
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.
|
ReadWriteBinding |
retain()
Retain an additional reference to this object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCount, release
public ClusterBinding(Cluster cluster, ReadPreference readPreference)
cluster
- a non-null Cluster which will be used to select a server to bind toreadPreference
- a non-null ReadPreference for read operationspublic ReadWriteBinding retain()
ReferenceCounted
retain
in interface ReadBinding
retain
in interface ReadWriteBinding
retain
in interface ReferenceCounted
retain
in interface WriteBinding
public ReadPreference getReadPreference()
ReadBinding
getReadPreference
in interface ReadBinding
public ConnectionSource getReadConnectionSource()
ReadBinding
getReadConnectionSource
in interface ReadBinding
public ConnectionSource getWriteConnectionSource()
WriteBinding
getWriteConnectionSource
in interface WriteBinding
public int getCount()
ReferenceCounted
getCount
in interface ReferenceCounted
public void release()
ReferenceCounted
release
in interface ReferenceCounted