Domino Java Agent running longer than maximum server execution time - looking for 'Terminate' event

StackOverflow https://stackoverflow.com/questions/23631546

  •  21-07-2023
  •  | 
  •  

Question

I am stress-testing a domino java agent which modifies potentially many documents in potentially many databases. I am load-testing the agent with huge databases and my agents are being shut down by the agent manager as they last longer than the specified input in the server document 'Max LotusScript/Java execution time:'.

I am aware that I can write a program document to let the agent run without any timing but don't want to do this since you lose the handle to the agent.

I am aware that I need to program the agent so that I can save the 'task' document (which contains all the instructions for the agent) in an 'unfinished' state so that I can start from where I stopped.

Writing LotusScript agents, there was a possibility of writing cleanup code in the 'Terminate' event of the agent, and I am missing this option for my java agent.

At the moment my best idea is to have a 'timeout' field in my configuration, which would be filled by a value smaller than the server cut-off time. This would imply, however, that I would be asking at very regular intervals the question 'Do I still have time to start the next action?' which I assume is going to kill the performance.

What's your experience with best practise for this case?

Was it helpful?

Solution

Apart from DOTS and a Java Application approach, here are two other alternatives.

Option 1: This is where you want to use a program document and still have some visibility to interact with your agent.

Add checks in your code to check either a file on disk or a document field. If the file is there, or field set then tell your application to start cleaning up.

There would be more overhead on checking a document then checking a file on disk.

Option 2: You can use a java.util.Timer object.

Have this set to execute for ServerMaximumTimeout - X minute/s. In the timer code throw a TimeoutException. Have your main code catch this Exception and do the clean up.

Then in your finally block clean up the timer object if it hasn't died yet.

More details on this in another question.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top