There are some things that drive me nuts about the way Domino has implemented the Java interfaces to the back end classes. One of them is the need to call .recycle(). The problem is that if you don't explicitly call recycle() on each object your have created, it hangs around forever -- even after the agent has finished. Of course, you can't call recycle() on an object you don't have a handle to, so you have to do things like use another handle "nextDoc" along with your "doc" object when you loop through collections. Since you're dealing with lots of objects as you go through a collection, you need to remember to call doc.recycle() just before you set "doc = nextDoc;" and then "nextDoc = docCollection.getNextDocument(doc);".
In most cases, that's enough. If you do that, and then at the end of your agent call session.recycle() you've done enough because recycling the session causes all the objects that stem from the session to get recycled too.
Not always though. I got reminded of this debugging a problem today in a pre-release of some new software I'm getting close to release on. The people doing the testing ran the product against all the databases on a server -- at once. That's what the product does, so it should be no problem -- but there were many thousands of them. It wasn't enough that I was managing the recycle() on the documents, I needed to recycle the database objects as I went through them as well. There weren't enough handles within the system to allow me to have them all out there until the end of the agent.
Poor handling on my part of course -- my laziness in that regard cost me many hours of coding today.
Comment Entry |
Please wait while your document is saved.
He published his latest post on this topic just the other day:
http://www.nsftools.com/blog/blog-11-2004.htm#11-03-04