agave-tags/tags-api/src/test/java/org/iplantc/service/tags/AbstractTagIT.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 .
@AfterMethod
	protected void clearQueues() 
	{
		ClientImpl client = null;
		client = new ClientImpl(Settings.MESSAGING_SERVICE_HOST,
				Settings.MESSAGING_SERVICE_PORT);
		for (String tube: client.listTubes())
		{
			try {
				client.watch(tube);
				client.useTube(tube);
				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(tube); } catch (Throwable ignored) {}
			}
		}
		try { client.close(); } catch (Throwable ignored) {}
		client = null;
	}
@ AfterMethod protected void clearQueues ( ) { ClientImpl client = null ; client = new ClientImpl ( Settings . MESSAGING_SERVICE_HOST , Settings . MESSAGING_SERVICE_PORT ) ; for ( String tube : client . listTubes ( ) ) { try { client . watch ( tube ) ; client . useTube ( tube ) ; 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 ( tube ) ; } catch ( Throwable ignored ) { } } } try { client . close ( ) ; } catch ( Throwable ignored ) { } 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