public abstract class ReadPreference extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ReadPreference.TaggedReadPreference
Deprecated.
As of release 2.9, replaced by
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets) |
Modifier and Type | Field and Description |
---|---|
static ReadPreference |
PRIMARY
Deprecated.
As of release 2.9.0, replaced by
ReadPreference.primary() |
static ReadPreference |
SECONDARY
Deprecated.
As of release 2.9.0, replaced by
ReadPreference.secondaryPreferred() |
Modifier and Type | Method and Description |
---|---|
abstract String |
getName()
The name of this read preference.
|
abstract boolean |
isSlaveOk() |
static ReadPreference |
nearest() |
static TaggableReadPreference |
nearest(DBObject firstTagSet,
DBObject... remainingTagSets) |
static ReadPreference |
primary() |
static ReadPreference |
primaryPreferred() |
static TaggableReadPreference |
primaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
static ReadPreference |
secondary() |
static TaggableReadPreference |
secondary(DBObject firstTagSet,
DBObject... remainingTagSets) |
static ReadPreference |
secondaryPreferred() |
static TaggableReadPreference |
secondaryPreferred(DBObject firstTagSet,
DBObject... remainingTagSets) |
abstract DBObject |
toDBObject() |
static ReadPreference |
valueOf(String name) |
static TaggableReadPreference |
valueOf(String name,
DBObject firstTagSet,
DBObject... remainingTagSets) |
static ReadPreference |
withTags(DBObject tags)
Deprecated.
As of release 2.9.0, replaced by
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets) |
static ReadPreference |
withTags(Map<String,String> tags)
Deprecated.
As of release 2.9.0, replaced by
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets) |
@Deprecated public static final ReadPreference PRIMARY
ReadPreference.primary()
ReadPreference.primary()
.primary()
@Deprecated public static final ReadPreference SECONDARY
ReadPreference.secondaryPreferred()
ReadPreference.secondaryPreferred
. This reference should really have been called
ReadPreference.SECONDARY_PREFERRED
, but the naming of it preceded the idea of distinguishing
between secondary and secondary-preferred, so for backwards compatibility, leaving the name as is with
the behavior as it was when it was created.secondary()
,
secondaryPreferred()
public abstract boolean isSlaveOk()
true
if this preference allows reads or commands from secondary nodespublic abstract DBObject toDBObject()
DBObject
representation of this preferencepublic abstract String getName()
public static ReadPreference primary()
public static ReadPreference primaryPreferred()
public static TaggableReadPreference primaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets)
public static ReadPreference secondary()
public static TaggableReadPreference secondary(DBObject firstTagSet, DBObject... remainingTagSets)
public static ReadPreference secondaryPreferred()
public static TaggableReadPreference secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets)
public static ReadPreference nearest()
public static ReadPreference valueOf(String name)
public static TaggableReadPreference valueOf(String name, DBObject firstTagSet, DBObject... remainingTagSets)
public static TaggableReadPreference nearest(DBObject firstTagSet, DBObject... remainingTagSets)
@Deprecated public static ReadPreference withTags(Map<String,String> tags)
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets)
@Deprecated public static ReadPreference withTags(DBObject tags)
ReadPreference.secondaryPreferred(DBObject firstTagSet, DBObject... remainingTagSets)