This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
I made a change to cache connections in the ConnectionList class. This was done as a workaround to the fact that a Lookup for a given database connection doesn't return the same object even though it should, and thus the live JDBC connection associated with the DatabaseConnection is lost. However, this solution is not workable long-term, because if an API user dynamically adds a connection, we don't pick this up right now without a restart. One possible solution is to use the lookup listener to detect the new connection being added and add it to the cache this way. We should create a unit test that reproduces this problem (a dynamically added connection not being detected), and then verifies that we've fixed it.
Changing the title of the bug to reflect the problem, not the solution. Note that I haven't reproduced the problem, but I am pretty sure it's there knowing how the code is written.
Actually, this is not true. I am noticing programmatically added connections being detected. The issue is if someone adds a connection using a layer file - I don't think we notice those. The fix is to add a lookup listener that adds the new connection to the cache.
The right solution is to ask for the maintainer of data systems to fix the lookup problem. I do not support the addition of yet another caching layer. That is the task of data systems, they should perform it correctly. Another thing it that I'm not convinced that the caching is actually working around the lookup problem. The lookup bug was filed back in 5.5 times, still the DB Explorer worked fine before 6.5 as far as I can remember. I suspect the problem is a different one: the DatabaseConnection instances returned by the lookup were not held strongly by the DB Explorer. Lookup doesn't hold them strongly, so they could be garbage-collected. Keeping them in ConnectionList is not right -- just a workaround.
Yes, good points. I'd rather not cache if we can help it. I was unaware of the strong/weak holding of references being part of the issue.
Rob, I'm passing this over to you because I think this issue is intimately involved with what you're working on. Feel free to assign back to me if you want.
No problem, I'll work on it.
Fixed as a side effect of #4c829f9abb13.