Package com.mongodb.binding
Class ClusterBinding
- java.lang.Object
-
- com.mongodb.binding.ClusterBinding
-
- All Implemented Interfaces:
ReadBinding
,ReadWriteBinding
,ReferenceCounted
,WriteBinding
Deprecated.
@Deprecated public class ClusterBinding extends Object implements ReadWriteBinding
A simple ReadWriteBinding implementation that supplies write connection sources bound to a possibly different primary each time, and a read connection source bound to a possible different server each time.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ClusterBinding(Cluster cluster, ReadPreference readPreference)
Deprecated.ClusterBinding(Cluster cluster, ReadPreference readPreference, ReadConcern readConcern)
Deprecated.Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
getCount()
Gets the current reference count, which starts at 0.ConnectionSource
getReadConnectionSource()
Deprecated.Returns a connection source to a server that satisfies the specified read preference.ReadPreference
getReadPreference()
Deprecated.The read preference that all connection sources returned by this instance will satisfy.SessionContext
getSessionContext()
Deprecated.Gets the session context for this binding.ConnectionSource
getWriteConnectionSource()
Deprecated.Supply a connection source to a server that can be written tovoid
release()
Release a reference to this object.ReadWriteBinding
retain()
Deprecated.Retain an additional reference to this object.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.mongodb.binding.ReferenceCounted
getCount, release
-
-
-
-
Constructor Detail
-
ClusterBinding
@Deprecated public ClusterBinding(Cluster cluster, ReadPreference readPreference)
Deprecated. PreferClusterBinding(Cluster, ReadPreference, ReadConcern)
Creates an instance.- Parameters:
cluster
- a non-null Cluster which will be used to select a server to bind toreadPreference
- a non-null ReadPreference for read operations
-
ClusterBinding
public ClusterBinding(Cluster cluster, ReadPreference readPreference, ReadConcern readConcern)
Deprecated.Creates an instance.- Parameters:
cluster
- a non-null Cluster which will be used to select a server to bind toreadPreference
- a non-null ReadPreference for read operationsreadConcern
- a non-null read concern- Since:
- 3.8
-
-
Method Detail
-
retain
public ReadWriteBinding retain()
Deprecated.Description copied from interface:ReferenceCounted
Retain an additional reference to this object. All retained references must be released, or there will be a leak.- Specified by:
retain
in interfaceReadBinding
- Specified by:
retain
in interfaceReadWriteBinding
- Specified by:
retain
in interfaceReferenceCounted
- Specified by:
retain
in interfaceWriteBinding
- Returns:
- this
-
getReadPreference
public ReadPreference getReadPreference()
Deprecated.Description copied from interface:ReadBinding
The read preference that all connection sources returned by this instance will satisfy.- Specified by:
getReadPreference
in interfaceReadBinding
- Returns:
- the non-null read preference
-
getReadConnectionSource
public ConnectionSource getReadConnectionSource()
Deprecated.Description copied from interface:ReadBinding
Returns a connection source to a server that satisfies the specified read preference.- Specified by:
getReadConnectionSource
in interfaceReadBinding
- Returns:
- the connection source
-
getSessionContext
public SessionContext getSessionContext()
Deprecated.Description copied from interface:ReadBinding
Gets the session context for this binding.- Specified by:
getSessionContext
in interfaceReadBinding
- Specified by:
getSessionContext
in interfaceWriteBinding
- Returns:
- the session context, which may not be null
-
getWriteConnectionSource
public ConnectionSource getWriteConnectionSource()
Deprecated.Description copied from interface:WriteBinding
Supply a connection source to a server that can be written to- Specified by:
getWriteConnectionSource
in interfaceWriteBinding
- Returns:
- a connection source
-
getCount
public int getCount()
Description copied from interface:ReferenceCounted
Gets the current reference count, which starts at 0.- Specified by:
getCount
in interfaceReferenceCounted
- Returns:
- the current count, which must be greater than or equal to 0
-
release
public void release()
Description copied from interface:ReferenceCounted
Release a reference to this object.- Specified by:
release
in interfaceReferenceCounted
-
-