#dominoforever | Product Ideas Portal

Welcome to the #dominoforever Product Ideas Forum! The place where you can submit product ideas and enhancement request. We encourage you to participate by voting on, commenting on, and creating new ideas. All new ideas will be evaluated by HCL Product Management & Engineering teams, and the next steps will be communicated. While not all submitted ideas will be executed upon, community feedback will play a key role in influencing which ideas are and when they will be implemented.

For more information and upcoming events around #dominoforever, please visit our Destination Domino Page

Add Session.setReuseDocumentHandles(boolean) to prevent Java API from reusing handles of open documents

When opening a document in the Notes Java API (Notes.jar), there's an internal logic to check whether that document has been opened and not recycled before.

So for example in this snippet


Database db = session.getDatabase("Server1/Org", "test.nsf");

Document doc1 = db.getDocumentByUNID("3CABC08F5934F9F7A3EADACC42AAD52E");

Document doc2 = db.getDocumentByUNID("3CABC08F5934F9F7A3EADACC42AAD52E");

doc1.recycle();

doc2.getFirstItem("TEST");


both doc1 and doc2 share the same internal C handle. This might have made sense years ago when only few free handles were available but that number has been increased.

There's no reference counting involved, so recycling one doc instance also recycles the second instance which is pretty bad when both docs were opened in different parts of a large codebase.

So the last line of my snippet, accessing the "TEST" item, will throw an exception.


Apart from causing "Object has been removed or recycled" exceptions, sharing doc handles also prevents developers from opening the doc a second time to compare old/new item values after a change or run operations like a temporary richtext-to-MIME conversions on a doc (case in point, in one of our applications we want to mirror a "body" richtext item as "bodymime" on doc save).


Using the C API or alternative APIs like Domino JNA handles are not shared. Please add a switch on Session level, e.g. Session.setReuseDocumentHandles(boolean) to disable sharing in Notes.jar as well.


Karsten Lehmann, Mindoo GmbH


  • Guest
  • Sep 27 2022
  • Under Consideration
  • Attach files