Monday, February 13, 2012

How to run Domino Java agents in Multi threads

You could use ExecutorService for Domino Java for running Domino Java agents in the few threads.

There is only one attention:

You know that code will wait until or agent.runOnServer() finish. It looks like this methods using thread.wait() for waiting the end of the task. So interrupt() in NotesExecutorService.NotesTask.stopThread() will interrupt not only the NotesTask thread itself but also.

If you are using ExecutorService for Domino Java for running agents then you need to run task in the synchronized method to avoid calling .stopThread() [read interrupt()] until it waits agent finishing [read done] 

Changes under the cut

Form aku.domino.extended.threads.NotesExecutorService.NotesTask.runNotes()


No comments: