[JAVA-179] Use weakrefs for static list of Mongo instances Created: 09/Oct/10  Updated: 29/Oct/10  Resolved: 17/Oct/10

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: 2.2
Fix Version/s: 2.3

Type: Improvement Priority: Minor - P4
Reporter: Scott Hernandez (Inactive) Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Use weakrefs for Mongo instances create by static methods.

http://github.com/scotthernandez/mongo-java-driver/commit/483b0372d37a3f699cacee7af852cfb809e08cbc



 Comments   
Comment by auto [ 17/Oct/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: let you have your own static Mongo pool, but not global JAVA-179
http://github.com/mongodb/mongo-java-driver/commit/abf2275582151d2f1748af983a8791909575b709

Comment by auto [ 17/Oct/10 ]

Author:

{'login': 'erh', 'name': 'Eliot Horowitz', 'email': 'eliot@10gen.com'}

Message: some more work on MongoURI and removing some static
JAVA-83 JAVA-179
http://github.com/mongodb/mongo-java-driver/commit/0a0af2734e13bea5028bb7aa37a0d9dc945b50a6

Comment by Eliot Horowitz (Inactive) [ 09/Oct/10 ]

Yeah - that's kind of what i was thinking.
Will think about more.

Comment by Scott Hernandez (Inactive) [ 09/Oct/10 ]

What about a sep. singleton class (MongoCache/Factory) which manages this? It can have methods like the statics on Mongo but can also have a flush/clear method that you can call to move all the Mongo instances into weakrefs so that they can be garbabe collected if they want. It can be made very clear that working with the factory requires managing the life-time of the Mongo instances in a special way, manually.

Comment by Eliot Horowitz (Inactive) [ 09/Oct/10 ]

Right - that was the idea.

Maybe we can make a seperate thing for this instead of that static method...

Will think about

Comment by Scott Hernandez (Inactive) [ 09/Oct/10 ]

As long as they are being used they will stick around.

The purpose is to always have them avail? That means they will not get cleaned up until the classloader is collected?

Comment by Eliot Horowitz (Inactive) [ 09/Oct/10 ]

That kind of defeats the purpose...

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