com.mongodb
Class ReplicaSetStatus

java.lang.Object
  extended by com.mongodb.ReplicaSetStatus

@ThreadSafe
public class ReplicaSetStatus
extends Object

Keeps replica set status. Maintains a background thread to ping all members of the set to keep the status current.


Field Summary
protected  boolean _closed
           
protected  Mongo _mongo
           
protected  MongoOptions _mongoOptions
           
protected  List<ServerAddress> _mongosAddresses
           
protected  com.mongodb.ConnectionStatus.BackgroundUpdater _updater
           
protected static DBObject isMasterCmd
           
protected static float latencySmoothFactor
           
protected static MongoOptions mongoOptionsDefaults
           
protected static int updaterIntervalMS
           
protected static int updaterIntervalNoMasterMS
           
 
Method Summary
 ServerAddress getMaster()
           
 int getMaxBsonObjectSize()
          Gets the maximum size for a BSON object supported by the current master server.
 String getName()
           
 boolean isMaster(ServerAddress srv)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_updater

protected com.mongodb.ConnectionStatus.BackgroundUpdater _updater

_mongo

protected final Mongo _mongo

_mongosAddresses

protected final List<ServerAddress> _mongosAddresses

_closed

protected volatile boolean _closed

_mongoOptions

protected final MongoOptions _mongoOptions

updaterIntervalMS

protected static int updaterIntervalMS

updaterIntervalNoMasterMS

protected static int updaterIntervalNoMasterMS

mongoOptionsDefaults

protected static final MongoOptions mongoOptionsDefaults

latencySmoothFactor

protected static final float latencySmoothFactor

isMasterCmd

protected static final DBObject isMasterCmd
Method Detail

getName

public String getName()

toString

public String toString()
Overrides:
toString in class Object

getMaster

public ServerAddress getMaster()
Returns:
master or null if don't have one
Throws:
MongoException

isMaster

public boolean isMaster(ServerAddress srv)
Parameters:
srv - the server to compare
Returns:
indication if the ServerAddress is the current Master/Primary
Throws:
MongoException

getMaxBsonObjectSize

public int getMaxBsonObjectSize()
Gets the maximum size for a BSON object supported by the current master server. Note that this value may change over time depending on which server is master.

Returns:
the maximum size, or 0 if not obtained from servers yet.
Throws:
MongoException