use of com.swiftmq.swiftlet.scheduler.JobException in project swiftmq-ce by iitsoftware.
the class MultiQueuePurgerJob method start.
public void start(Properties properties, JobTerminationListener jobTerminationListener) throws JobException {
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/start, properties=" + properties + " ...");
this.properties = properties;
termMsg = new StringBuffer();
if (stopCalled) {
terminate();
return;
}
try {
String predicate = properties.getProperty("Queue Name Predicate");
String[] names = ctx.queueManager.getDefinedQueueNames();
if (names != null) {
for (int i = 0; i < names.length; i++) {
if (!names[i].startsWith("tpc$")) {
if (LikeComparator.compare(names[i], predicate, '\\')) {
if (termMsg.length() > 0)
termMsg.append(", ");
termMsg.append(names[i]);
termMsg.append("=");
properties.put("Queue Name", names[i]);
currentJob = new QueuePurgerJob(ctx);
try {
currentJob.start(properties, this);
} catch (JobException e) {
termMsg.append(e.toString());
}
}
if (stopCalled)
break;
}
}
}
} catch (Exception e) {
terminate();
throw new JobException(e.toString(), e, false);
}
terminate();
jobTerminationListener.jobTerminated(termMsg.toString());
if (ctx.traceSpace.enabled)
ctx.traceSpace.trace(ctx.queueManager.getName(), toString() + "/finished, properties=" + properties);
}
Aggregations