use of org.cristalise.kernel.entity.Agent in project kernel by cristal-ise.
the class JobPusher method run.
@Override
public void run() {
String tName = "Agent job pusher for " + itemPath + ":" + activity.getPath() + " to role " + myRole;
Thread.currentThread().setName(tName);
Logger.msg(7, "JobPusher.run() - Started:" + tName);
try {
for (AgentPath nextAgent : Gateway.getLookup().getAgents(myRole)) {
Logger.msg(7, "JobPusher.run() - Calculating jobs for agent:" + nextAgent);
try {
// get joblist for agent
JobArrayList jobList = new JobArrayList(this.activity.calculateJobs(nextAgent, itemPath, false));
// push it to the agent
String stringJobs = Gateway.getMarshaller().marshall(jobList);
Agent thisAgent = AgentHelper.narrow(nextAgent.getIOR());
Logger.msg(7, "JobPusher.run() - Calling refreshJobList() with " + jobList.list.size() + " jobs for agent " + nextAgent + " from " + activity.getPath());
thisAgent.refreshJobList(itemPath.getSystemKey(), activity.getPath(), stringJobs);
} catch (Exception ex) {
Logger.error("JobPusher.run() - Agent " + nextAgent + " of role " + myRole + " could not be found to be informed of a change in " + itemPath);
Logger.error(ex);
}
}
} catch (ObjectNotFoundException e) {
Logger.warning("JobPusher cannot push jobs, it did not find any agents for role:" + myRole);
}
Logger.msg(7, "JobPusher.run() - FINISHED:" + tName);
}
Aggregations