[JAVA-805] Make connection pool and connection state observable Created: 12/Apr/13  Updated: 15/Jan/18  Resolved: 11/Jul/17

Status: Closed
Project: Java Driver
Component/s: API, Monitoring
Affects Version/s: None
Fix Version/s: 3.5.0

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Ross Lawley
Resolution: Done Votes: 7
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Duplicate
is duplicated by JAVA-788 Detecting Server Going Away? Closed
is duplicated by JAVA-799 Make it possible to get the replica s... Closed
is duplicated by JAVA-1110 Driver events Closed
is duplicated by JAVA-2459 Add support for ConnectionListener an... Closed
is duplicated by JAVA-991 Cannot determine actual ReplSetStatus... Closed
Related
is related to JAVA-1583 Disable JMX registration Closed
Case:

 Description   

It'd be potentially useful for the status of a replica set connection to be observable, so an observer can subscribe and be made aware of any events (eg. change in primary, no primary or no majority, etc.).

Similarly, it could be useful for the status of the connection pool and of each connection to be observable.

Specifically, the driver should surface the following events to listeners:

  1. connection pool opened
  2. connection pool closed
  3. connection added to pool
  4. connection removed from pool
  5. connection checked out of pool
  6. connection checked in to pool
  7. connection pool wait queue entered
  8. connection pool wait queue exited
  9. connection opened
  10. connection closed


 Comments   
Comment by Githook User [ 10/Jul/17 ]

Author:

{u'username': u'rozza', u'name': u'Ross Lawley', u'email': u'ross.lawley@gmail.com'}

Message: Made ConnectionListener and ConnectionPoolListener an official part of the API

JAVA-805
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/6be00a8897317c3a67ec3f7700d4d1f2c732bbe9

Comment by Ross Lawley [ 15/Jun/17 ]

PR: https://github.com/rozza/mongo-java-driver/pull/204

Comment by Jeffrey Yemin [ 13/Sep/13 ]

This is complete in core, but still need to expose a way to add listeners via MongoClientOptions

Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Ensure than the pool sends no more events after it's been closed.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/a40eb209e8eafad3a2265e6896fbefa3e827a5d5

Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Variable name changes, inlined variables, and formatting
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/fcd589e764a864fd83b20edd16b3613817982c13

Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Removed Cluster change listener support, as it's superseded by ClusterListener.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/3fa2da37870ccc0b9331f661903c947de4f98845

Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Created JMX connection pool listener and removed explicit JMX support from PooledConnectionProvider
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/33bee8144186808b89dccc1cf750db14efef093c

Comment by auto [ 13/Sep/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Implemented connection events in the internal connection, In order to send the event properly, needed a few extras like the cluster id and the request id of the sent message.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/7c84b188625da2cc36f826dacc81d997b8a3739c

Comment by Jeffrey Yemin [ 12/Jul/13 ]

The underpinnings are here, but this still needs to be exposed via MongoClient

Comment by auto [ 26/Jun/13 ]

Author:

{u'username': u'jyemin', u'name': u'Jeff Yemin', u'email': u'jeff.yemin@10gen.com'}

Message: JAVA-805: Make cluster state observable via a change listener. Care had to be taken to fire the change events outside of a lock, in case a change listener does not complete quickly.
Branch: 3.0.x
https://github.com/mongodb/mongo-java-driver/commit/de13453dbafa0b8bde186d8fe98330f3b61366e0

Comment by Jeffrey Yemin [ 12/Apr/13 ]

Stephen is thinking more of a notification system rather than polling ReplicaSetStatus.getMastert(). It's a reasonable request.

Comment by Scott Hernandez (Inactive) [ 12/Apr/13 ]

You can get access to the replica state already. See Mongo.getReplicaSetStatus()

Generated at Thu Feb 08 08:53:07 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.