agave-notifications/notifications-core/src/test/java/org/iplantc/service/notification/AbstractNotificationTest.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 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 ignored) {}
			try { client.close(); } catch (Throwable ignored) {}
			client = null;
		}
	}
@ AfterMethod protected 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 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