The Lotus® Domino® server is designed to execute agents (LotusScript or Java) that exist in the same database sequentially, with only one agent running at a time. You can see this behavior if you set two agents in the same database to run at the same time, for example, 4:20 a.m. If you include a print to console within each agent, you might see the following output:
04:20:00 -> Agent1 starting in dbase1 (handled by Executive 1)
04:20:20 -> Agent1 finished in dbase1 (handled by Executive 1)
04:20:21 -> Agent2 starting in dbase1 (handled by Executive 1)
The output shows that the scheduled agents, in the same database, are processed sequentially, even though both are set to the same start time. If you have a need to run these agents at the same time, that is, concurrently, can you do so?
Note: Agents running in different databases can execute at the same time on the server.
To have two or more agents running concurrently in the same database, you can use a third Java-agent as a wrapper to start the two agents from within its code instead of scheduling them to run on the server. This method applies to LotusScript or Java agents. For another approach using Program documents, refer to "How to run more then one agent in the same database using a Program document" (1279832).
Note, however, that this method is unsupported, because you are working around the normal Domino functionality.
When using such a wrapper and running two agents concurrently in the same database, it is imperative to ensure that the agent logic does not cause issues resulting from concurrent access to resources such as notes.
In the case of notes, it can be helpful to activate document locking.
The agent logic needs to take care of any potential overlapping access to data. The agent designer has to consider this need at the time of designing the agent.
If you use this wrapper code with existing agents, they agents might require a review to make sure the logic considers a concurrent run.
A large number of agents running on the same database at the same time can have potential performance issues.
Code for the Java-wrapper agent
public class JavaAgent extends AgentBase
public void NotesMain()
System.out.println("Main agent started");
Session session = getSession();
AgentContext agentContext = session.getAgentContext();
//create agent objects -> replace "Agent1" and "Agent2"
//with the actual agent names
ag a1=new ag("Agent1",db);
ag a2=new ag("Agent2",db);
//run both agents
}while(a1.isAlive() || a2.isAlive());
System.out.println("Main agent ended.");
class ag extends NotesThread
private Agent agent;
public ag(String agentName,Database db)
public void runNotes()
// Access agent property before running it
// this avoids SPR# TCAR6LLJF3
System.out.println("Thread for agent "+agent.getName()+"started.");
System.out.println("Thread for agent "+agent.getName()+"exiting.");
Sample console output with wrapper agent
The output created by this code on the server console will look like the following:
> tell amgr run "test2.nsf" 'StartAgents'
14:00:22 AMgr: Start executing agent 'StartAgents' in 'test2.nsf'
12:00:22 Agent printing: Main agent started
12:00:22 Agent printing: Thread for agent Agent1 started.
12:00:22 Agent printing: Thread for agent Agent2 started.
12:00:22 Agent printing: Agent2 started
12:00:22 Agent printing: Agent1 started
(...Both agents are working now... )
12:01:13 Agent printing: Agent2 ended
12:01:13 Agent printing: Thread for agent Agent2 exiting.
12:01:13 Agent printing: Agent1 ended
12:01:13 Agent printing: Thread for agent Agent1 exiting.
12:01:13 Agent printing: Main agent ended.
12:01:13 AMgr: Agent 'StartAgents' in 'test2.nsf' completed execution