@@ -21,14 +21,8 @@ class ReplicaSetStatus {
2121
2222 static final Logger _rootLogger = Logger .getLogger ( "com.mongodb.ReplicaSetStatus" );
2323
24- ReplicaSetStatus ( Mongo m , List <ServerAddress > initial , DBConnector connector ){
25- _mongo = m ;
24+ ReplicaSetStatus ( List <ServerAddress > initial ){
2625
27- if ( connector == null )
28- _adminDB = m .getDB ( "admin" );
29- else
30- _adminDB = new DBApiLayer ( m , "admin" , connector );
31-
3226 _all = Collections .synchronizedList ( new ArrayList <Node >() );
3327 for ( ServerAddress addr : initial ){
3428 _all .add ( new Node ( addr ) );
@@ -109,7 +103,7 @@ class Node {
109103 synchronized void update (){
110104 try {
111105 long start = System .currentTimeMillis ();
112- CommandResult res = _port .runCommand ( _adminDB , _isMasterCmd );
106+ CommandResult res = _port .runCommand ( "admin" , _isMasterCmd );
113107 _lastCheck = System .currentTimeMillis ();
114108 _pingTime = _lastCheck - start ;
115109
@@ -146,7 +140,7 @@ synchronized void update(){
146140 return ;
147141
148142 try {
149- DBObject config = _port .findOne ( _mongo . getDB ( "local" ) , " system.replset" , new BasicDBObject () );
143+ DBObject config = _port .findOne ( "local. system.replset" , new BasicDBObject () );
150144 if ( config == null ){
151145 // probbaly a replica pair
152146 // TODO: add this in when pairs are really gone
@@ -316,8 +310,6 @@ void close(){
316310 _closed = true ;
317311 }
318312
319- final Mongo _mongo ;
320- final DB _adminDB ;
321313
322314 final List <Node > _all ;
323315 Updater _updater ;
@@ -345,7 +337,7 @@ public static void main( String args[] )
345337
346338 Mongo m = new Mongo ( addrs );
347339
348- ReplicaSetStatus status = new ReplicaSetStatus ( m , addrs , null );
340+ ReplicaSetStatus status = new ReplicaSetStatus ( addrs );
349341 System .out .println ( status .ensureMaster ()._addr );
350342
351343 while ( true ){
0 commit comments