Open jesse-gallagher opened 2 years ago
Is there a way to call DominoProcess.get().initializeProcess(new String[0]) + DominoProcess.get().terminateProcess() multiple times, without this bug being solved? We are calling domino from api endpoints and want to initialize and stop the process with every call.
I am not sure if calling initialize/terminateProcess multiple times is supported by Domino. I remember that we had issues doing this and the recommended way was to call them once when an application that accesses Domino starts and shuts down and then just call initialize/termThread for the current thread, which BTW fall back to the classic lotus.domino.NotesThread.sinitThread()/.stermThread() where possible since these internally contain more initialization code than their C API equivalents. @jesse-gallagher what do you think?
I'd really like to find a good way to at least check if it's in a standard Domino task like HTTP or DOTS, though the "true" way to do that requires that the process already be initialized. I'm considering doing something like having a check for a Java system property that is set by Equinox, and then have a note somewhere telling anyone that happens to have an environment that looks a lot like that to manually call it.
Thanks for the response.
We build our code in Java and use notes.jar in conjunction with recycle() method to interact with Domino. We build an update site for clients and use pde tooling while developing. In our code we recycle as soon as possible and that results in very stable code.
Now we started to use domino-jnx and only call the terminateProcess if we shut down the HTTP (via the osgi BundleActivator stop method).
While developing, a lot of our developers just shut down the server or switch branches during development without restarting the domino server, resulting in not calling the terminateProcess. Doing so crashes the server on the next start-up.
I'm trying to find a solution for them.
I don't think you have to call initializeProcess/terminateProcess at all if your code is running within the HTTP task. Do we enforce this in the API?
Yeah, ideally those methods would never be called at all inside a task like nhttp, but the API enforces that internal flags have been set. The trouble is that we can't know for sure that it was already initialized without initializing it. I'm considering now something like an OSGi fragment bundle in the XSP distribution that tips off the API that those methods should either not be called or should be no-ops.
Probably it'll be better if such a fragment causes JNX to skip the "has it been initialized?" test for both the process and the thread - since the process should never be init/termed, but a thread might need to be.
Specifically, this seems to be caused by
processTerminated
being set. In a case where thejnx.noterm
property is configured, that should instead be taken to mean "JNX is not in charge of the Notes process and should not assume so", and so it should be safe to callDominoProcess.get().terminateProcess()
multiple times.Alternatively, it may be best to fix this overall by making it so that a given property or environment detection ( https://github.com/HCL-TECH-SOFTWARE/domino-jnx/issues/20 ) makes it so that
DominoProcess
init/term doesn't need to be called at all.