[CSHARP-382] MongoServer should allow introspection of exising servers Created: 17/Jan/12  Updated: 02/Apr/15  Resolved: 06/Feb/12

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.3.1
Fix Version/s: 1.4

Type: New Feature Priority: Major - P3
Reporter: Aristarkh Zagorodnikov Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I would like to ask to add a method to get all created servers, to allow run-time diagnostics, i.e. obtaining a list of all created servers, then accessing all instances, then checking connection pool limits, etc.

public static void GetAllServers() {
lock (staticLock)

{ return servers.Values.ToList(); }

}



 Comments   
Comment by Aristarkh Zagorodnikov [ 07/Feb/12 ]

Thank you very much, Robert.

Comment by Aristarkh Zagorodnikov [ 01/Feb/12 ]

MongoServer[] would be fine, it's intended to be a snapshot.

Comment by Robert Stam [ 31/Jan/12 ]

What should the type of the return value be? Options include:

MongoServer[]
ReadOnlyCollection<MongoServer>
// and maybe but less likely
IEnumerable<MongoServer>
IList<MongoServer>

Either way I don't think there is any way to avoid creating a snapshot (or copy) of the current values.

Generated at Wed Feb 07 21:36:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.