Domino cycle in the Java agent problems that may occur
Few days ago, the domino background was found to have errors:
AllocHandle: OUT OF PRIVATE HANDLES! - Pid 000039F8 Handles used so far 6399, Maximum handles = 16446, error = 0×107
Code inspection determined problems in a regular java agent circle.
View docView = config.app_db.getView ( "ALLDOC");
Document middleDoc;
Document curDoc = docView.getFirstDocument ();
Vector cal = new Vector ();
While (curDoc! = Null) (
MiddleDoc = docView.getNextDocument (curDoc);
Cal = session.evaluate (config.arc_create_fomular, curDoc);
If (cal.get (0). ToString (). Equals ( "1.0")) (
Correspond + = 1;
)
CurDoc = middleDoc;
If (correspond> = config.maxArchive) break;
)
Ibm engineers associated with the given answer is:
Each document opened in an agent allocates a private handle. When the document is closed by the agent, the handle is freed. Loops can be tricky. If the document isn't closed after processing, a handle will be allocated for every document processed in the loop.
This isn't a concern in small databases with few documents processed, but in larger databases, it can become an issue.
After the help of the designer, found:
Java has no knowlege of the heavyweight back-end Domino Objects, only the lightweight Java objects representing them. Garbage collection has no effect on Domino Objects unless you first explicitly recycle them.
To determine, the problem is the absence of timely release of the domino background object. Of the code to do the following:
View docView = config.app_db.getView ( "ALLDOC");
Document middleDoc;
Document curDoc = docView.getFirstDocument ();
Vector cal = new Vector ();
While (curDoc! = Null) (
MiddleDoc = docView.getNextDocument (curDoc);
Cal = session.evaluate (config.arc_delete_fomular, curDoc);
If (cal.get (0). ToString (). Equals ( "1.0")) (
Correspond + = 1;
)
CurDoc.recycle ();
CurDoc = null;
CurDoc = middleDoc;
If (correspond> = config.maxArchive) break;
)
To the implementation of agents, there is no wrong background.
It can be concluded that the domino of java agent, when the target is a database objects and implementation cycle, the only agent of the final session to recycle is not enough, and we should pay attention to the cycle of the release of timely resources.






