4 ms·
The most effective way to handle these kind of errors in Java unfortunately requires understanding class loading, thread contexts, wrapping connection primitive
by mickronome 10y ago
The most effective way to handle these kind of errors in Java unfortunately requires understanding class loading, thread contexts, wrapping connection primitives in the right kind of references, and then making sure that all resource deallocation/closing always use the same codepath. Even though you really only need to implemnt it once, it is both somewhat tricky and technically challenging.
It's a pity that so few Java projects have tried to use these mechanisms without building them as part of massive frameworks, sometimes apparently even without understanding what they have built.
- algesten 10y agoYes, I did spend large parts of my java developer looking at class loaders and class loading delegations in servlet containers etc. I think it's a bit too hard to get it right. Like, suddenly some third party library starts pulling in log4j and your whole logging setup goes wrong in subtle yet very bad ways. Or you screwed up with that one reference to a ResultSet and even though it is closed, that reference keeps an entire class tree of Connection, PreparedStatement etc alive.
- deleted 10y ago[deleted]