Package com.mongodb.binding
Class SingleServerBinding
- java.lang.Object
-
- com.mongodb.binding.SingleServerBinding
-
- All Implemented Interfaces:
ReadBinding,ReadWriteBinding,ReferenceCounted,WriteBinding
Deprecated.
@Deprecated public class SingleServerBinding extends Object implements ReadWriteBinding
A simple binding where all connection sources are bound to the server specified in the constructor.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description SingleServerBinding(Cluster cluster, ServerAddress serverAddress)Deprecated.Creates an instance, defaulting toReadPreference.primary()for reads.SingleServerBinding(Cluster cluster, ServerAddress serverAddress, ReadPreference readPreference)Deprecated.Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description intgetCount()Gets the current reference count, which starts at 0.ConnectionSourcegetReadConnectionSource()Deprecated.Returns a connection source to a server that satisfies the specified read preference.ReadPreferencegetReadPreference()Deprecated.The read preference that all connection sources returned by this instance will satisfy.SessionContextgetSessionContext()Deprecated.Gets the session context for this binding.ConnectionSourcegetWriteConnectionSource()Deprecated.Supply a connection source to a server that can be written tovoidrelease()Release a reference to this object.SingleServerBindingretain()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
-
SingleServerBinding
public SingleServerBinding(Cluster cluster, ServerAddress serverAddress)
Deprecated.Creates an instance, defaulting toReadPreference.primary()for reads.- Parameters:
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 to
-
SingleServerBinding
public SingleServerBinding(Cluster cluster, ServerAddress serverAddress, ReadPreference readPreference)
Deprecated.Creates an instance.- Parameters:
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 operations
-
-
Method Detail
-
getWriteConnectionSource
public ConnectionSource getWriteConnectionSource()
Deprecated.Description copied from interface:WriteBindingSupply a connection source to a server that can be written to- Specified by:
getWriteConnectionSourcein interfaceWriteBinding- Returns:
- a connection source
-
getReadPreference
public ReadPreference getReadPreference()
Deprecated.Description copied from interface:ReadBindingThe read preference that all connection sources returned by this instance will satisfy.- Specified by:
getReadPreferencein interfaceReadBinding- Returns:
- the non-null read preference
-
getReadConnectionSource
public ConnectionSource getReadConnectionSource()
Deprecated.Description copied from interface:ReadBindingReturns a connection source to a server that satisfies the specified read preference.- Specified by:
getReadConnectionSourcein interfaceReadBinding- Returns:
- the connection source
-
getSessionContext
public SessionContext getSessionContext()
Deprecated.Description copied from interface:ReadBindingGets the session context for this binding.- Specified by:
getSessionContextin interfaceReadBinding- Specified by:
getSessionContextin interfaceWriteBinding- Returns:
- the session context, which may not be null
-
retain
public SingleServerBinding retain()
Deprecated.Description copied from interface:ReferenceCountedRetain an additional reference to this object. All retained references must be released, or there will be a leak.- Specified by:
retainin interfaceReadBinding- Specified by:
retainin interfaceReadWriteBinding- Specified by:
retainin interfaceReferenceCounted- Specified by:
retainin interfaceWriteBinding- Returns:
- this
-
getCount
public int getCount()
Description copied from interface:ReferenceCountedGets the current reference count, which starts at 0.- Specified by:
getCountin interfaceReferenceCounted- Returns:
- the current count, which must be greater than or equal to 0
-
release
public void release()
Description copied from interface:ReferenceCountedRelease a reference to this object.- Specified by:
releasein interfaceReferenceCounted
-
-