agave-jobs/jobs-core/src/test/java/org/iplantc/service/jobs/dao/AbstractDaoTest.java
/**
     * Flushes the messaging tube of any and all existing jobs.
     */
Flushes the messaging tube of any and all existing jobs.
Flushes the messaging tube of any and all existing jobs .
public void drainQueue()
    {
        ClientImpl client = null;
        try {
            client = new ClientImpl(Settings.MESSAGING_SERVICE_HOST,
                    Settings.MESSAGING_SERVICE_PORT);
            client.watch(Settings.NOTIFICATION_QUEUE);
            client.useTube(Settings.NOTIFICATION_QUEUE);
            client.kick(Integer.MAX_VALUE);
            com.surftools.BeanstalkClient.Job beanstalkJob = null;
            do {
                try {
                    beanstalkJob = client.peekReady();
                    if (beanstalkJob != null)
                        client.delete(beanstalkJob.getJobId());
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            } while (beanstalkJob != null);
            do {
                try {
                    beanstalkJob = client.peekBuried();
                    if (beanstalkJob != null)
                        client.delete(beanstalkJob.getJobId());
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            } while (beanstalkJob != null);
            do {
                try {
                    beanstalkJob = client.peekDelayed();
                    if (beanstalkJob != null)
                        client.delete(beanstalkJob.getJobId());
                } catch (Throwable e) {
                    e.printStackTrace();
                }
            } while (beanstalkJob != null);
        } catch (Throwable e) {
            e.printStackTrace();
        }
        finally {
            try { client.ignore(Settings.NOTIFICATION_QUEUE); } catch (Throwable e) {}
            try { client.close(); } catch (Throwable e) {}
            client = null;
        }
    }
public void drainQueue ( ) { ClientImpl client = null ; try { client = new ClientImpl ( Settings . MESSAGING_SERVICE_HOST , Settings . MESSAGING_SERVICE_PORT ) ; client . watch ( Settings . NOTIFICATION_QUEUE ) ; client . useTube ( Settings . NOTIFICATION_QUEUE ) ; client . kick ( Integer . MAX_VALUE ) ; com . surftools . BeanstalkClient . Job beanstalkJob = null ; do { try { beanstalkJob = client . peekReady ( ) ; if ( beanstalkJob != null ) client . delete ( beanstalkJob . getJobId ( ) ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } while ( beanstalkJob != null ) ; do { try { beanstalkJob = client . peekBuried ( ) ; if ( beanstalkJob != null ) client . delete ( beanstalkJob . getJobId ( ) ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } while ( beanstalkJob != null ) ; do { try { beanstalkJob = client . peekDelayed ( ) ; if ( beanstalkJob != null ) client . delete ( beanstalkJob . getJobId ( ) ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } } while ( beanstalkJob != null ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } finally { try { client . ignore ( Settings . NOTIFICATION_QUEUE ) ; } catch ( Throwable e ) { } try { client . close ( ) ; } catch ( Throwable e ) { } client = null ; } }
Flushes the messaging tube of any and all existing jobs.
Flushes the messaging tube of any and all existing jobs .
// drain the message queue