Are your threads leaking? 07 Dec 2007
A very useful snippet gleaned from the IBM Support pages: Troubleshooting Java agent message ‘Error cleaning up agent threads’.
The article includes a handy method that can be walloped into your code to assess the state of your threads, and for some lo-fi memory profiling / troubleshooting, this can’t be beat. Well worth book-marking.
If I run this code and it tells me a certain thread is sitting out there, what am I supposed to do about it? I understand what recycle() does, but how on Earth am I supposed to know where to put it based on a thread ID?
I'm not venting or whining at you, Ben, I'm just confused by what this is really telling me. :-) I agree with Brendon's assessment: "Java programming in Notes is a clunky mess."Charles Robinson#
No no that’s fair enough Charles! Let me explain. Let’s say you get something like this in the console once your agent’s run:
Three threads, but you finish with just one (that of the agent itself): this is good. If you finish with something like this though:
… then you have something going wrong. It’s usually addressed by reviewing your code and ensuring that the relevant objects are disposed-of properly (e.g. in this example, ensuring that database connections are closed, and object drivers set to null).
Does that help?
Ben Poole#finallyblock where possible. It’s no panacea, but it helps!Ben Poole#If you keep some simple, though effective rules in mind, its not so much of a brainer. I have had no problem with larger productively deployed java code in notes production environments.
I have allways hoped that IBM (or anybody else) would create a garbage collector, which manages this issue more effectively.
Now, when we will get Notes Designer on Eclipse IBM could add a Builder to the compilation process of Java code in notes designer, which is going to check for promblems with this issue in the code. I don't think this is very complicated, as things like checkstyle or pmd analyze code too. Axel#