File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -454,7 +454,10 @@ void close(){
454
454
}
455
455
}
456
456
}
457
-
457
+
458
+ public ServerAddress getServerAddress () {
459
+ return _host ;
460
+ }
458
461
459
462
Response _curResult ;
460
463
Iterator <DBObject > _cur ;
Original file line number Diff line number Diff line change @@ -645,6 +645,20 @@ public DBCollection getCollection(){
645
645
return _collection ;
646
646
}
647
647
648
+ /**
649
+ * Gets the Server Address of the server that data is pulled from.
650
+ * Note that this information is not available if no data has been retrieved yet.
651
+ * Availability is specific to underlying implementation and may vary.
652
+ * @return
653
+ */
654
+ public ServerAddress getServerAddress () {
655
+ if (_it != null ) {
656
+ if (_it instanceof DBApiLayer .Result )
657
+ return ((DBApiLayer .Result )_it ).getServerAddress ();
658
+ }
659
+ return null ;
660
+ }
661
+
648
662
@ Override
649
663
public String toString () {
650
664
StringBuilder sb = new StringBuilder ();
@@ -658,6 +672,9 @@ public String toString() {
658
672
sb .append (", limit=" ).append (_numWanted );
659
673
if (_skip > 0 )
660
674
sb .append (", skip=" ).append (_skip );
675
+ ServerAddress addr = getServerAddress ();
676
+ if (addr != null )
677
+ sb .append (", addr=" ).append (addr );
661
678
return sb .toString ();
662
679
}
663
680
You can’t perform that action at this time.
0 commit comments