Search in sources :

Example 11 with JobException

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);
}
Also used : JobException(com.swiftmq.swiftlet.scheduler.JobException) JobException(com.swiftmq.swiftlet.scheduler.JobException)

Aggregations

JobException (com.swiftmq.swiftlet.scheduler.JobException)11 MessageImpl (com.swiftmq.jms.MessageImpl)2 Entity (com.swiftmq.mgmt.Entity)2 Property (com.swiftmq.mgmt.Property)2 MessageSelector (com.swiftmq.ms.MessageSelector)2 AbstractQueue (com.swiftmq.swiftlet.queue.AbstractQueue)2 Semaphore (com.swiftmq.tools.concurrent.Semaphore)2 InvalidSelectorException (javax.jms.InvalidSelectorException)2 StartBackup (com.swiftmq.impl.store.standard.backup.po.StartBackup)1 StartShrink (com.swiftmq.impl.store.standard.cache.po.StartShrink)1 QueueImpl (com.swiftmq.jms.QueueImpl)1 QueueException (com.swiftmq.swiftlet.queue.QueueException)1 ArrayList (java.util.ArrayList)1 Enumeration (java.util.Enumeration)1 List (java.util.List)1