drools-eclipse/org.kie.eclipse/src/main/java/org/kie/eclipse/server/KieServiceDelegate.java
public String getJobStatus(final String jobId, final String title) throws IOException, InterruptedException {
		final AtomicReference<String> ar = new AtomicReference<String>();

		IWorkbench wb = PlatformUI.getWorkbench();
		IProgressService ps = wb.getProgressService();
		try {
			ps.busyCursorWhile(new IRunnableWithProgress() {
				public void run(IProgressMonitor pm) throws InterruptedException {
					pm.beginTask("Waiting for Job "+jobId+":\n\n"+title, STATUS_REQUEST_TIMEOUT);
					pm.subTask(title);
					long startTime = System.currentTimeMillis();
					long stopTime = startTime;
					do {
						try {
							// send a Job Status request every STATUS_REQUEST_DELAY milliseconds
							Thread.sleep(STATUS_REQUEST_DELAY);
							String response = httpGet("jobs/" + jobId);
							JsonObject jo = JsonObject.readFrom(response);
							String status = jo.get("status").asString();
							String result = jo.get("result").asString();
							if ("null".equals(result)) {
								if (!"SUCCESS".equals(status))
									result = null;
							}
							if (status!=null && result!=null)
								ar.set(status + ":" + result);
							stopTime = System.currentTimeMillis();
							pm.worked(STATUS_REQUEST_DELAY);

							Activator.println("status="+status);
							Activator.println("result="+result);
						}
						catch (Exception e) {
							e.printStackTrace();
						}
						if (pm.isCanceled())
							throw new InterruptedException("Operation canceled");
					}
					while (ar.get()==null && stopTime - startTime < STATUS_REQUEST_TIMEOUT);
					pm.done();
					Activator.println(
							"\n----------------------------------\n"+
							"Job "+jobId+"\n"+title+"\ncompleted in "+(stopTime - startTime) / 1000.0+" sec\n"+
							"Status: " + ar.get()+
							"\n----------------------------------\n");
				}
			});
		}
		catch (InvocationTargetException e) {
			e.printStackTrace();
			return null;
		}

		return ar.get();
	}
public String getJobStatus(final String jobId, final String title) throws IOException, InterruptedException {
		final AtomicReference<String> ar = new AtomicReference<String>();

		IWorkbench wb = PlatformUI.getWorkbench();
		IProgressService ps = wb.getProgressService();
		try {
			ps.busyCursorWhile(new IRunnableWithProgress() {
				public void run(IProgressMonitor pm) throws InterruptedException {
					pm.beginTask("Waiting for Job "+jobId+":\n\n"+title, STATUS_REQUEST_TIMEOUT);
					pm.subTask(title);
					long startTime = System.currentTimeMillis();
					long stopTime = startTime;
					do {
						try {
							// send a Job Status request every STATUS_REQUEST_DELAY milliseconds
							Thread.sleep(STATUS_REQUEST_DELAY);
							String response = httpGet("jobs/" + jobId);
							JsonObject jo = JsonObject.readFrom(response);
							String status = jo.get("status").asString();
							String result = jo.get("result").asString();
							if ("null".equals(result)) {
								if (!"SUCCESS".equals(status))
									result = null;
							}
							if (status!=null && result!=null)
								ar.set(status + ":" + result);
							stopTime = System.currentTimeMillis();
							pm.worked(STATUS_REQUEST_DELAY);

							Activator.println("status="+status);
							Activator.println("result="+result);
						}
						catch (Exception e) {
							e.printStackTrace();
						}
						if (pm.isCanceled())
							throw new InterruptedException("Operation canceled");
					}
					while (ar.get()==null && stopTime - startTime < STATUS_REQUEST_TIMEOUT);
					pm.done();
					Activator.println(
							"\n----------------------------------\n"+
							"Job "+jobId+"\n"+title+"\ncompleted in "+(stopTime - startTime) / 1000.0+" sec\n"+
							"Status: " + ar.get()+
							"\n----------------------------------\n");
				}
			});
		}
		catch (InvocationTargetException e) {
			e.printStackTrace();
			return null;
		}

		return ar.get();
	}
public String getJobStatus ( final String jobId , final String title ) throws IOException , InterruptedException { final AtomicReference < String > ar = new AtomicReference < String > ( ) ; IWorkbench wb = PlatformUI . getWorkbench ( ) ; IProgressService ps = wb . getProgressService ( ) ; try { ps . busyCursorWhile ( new IRunnableWithProgress ( ) { public void run ( IProgressMonitor pm ) throws InterruptedException { pm . beginTask ( "Waiting for Job " + jobId + ":\n\n" + title , STATUS_REQUEST_TIMEOUT ) ; pm . subTask ( title ) ; long startTime = System . currentTimeMillis ( ) ; long stopTime = startTime ; do { try { // send a Job Status request every STATUS_REQUEST_DELAY milliseconds Thread . sleep ( STATUS_REQUEST_DELAY ) ; String response = httpGet ( "jobs/" + jobId ) ; JsonObject jo = JsonObject . readFrom ( response ) ; String status = jo . get ( "status" ) . asString ( ) ; String result = jo . get ( "result" ) . asString ( ) ; if ( "null" . equals ( result ) ) { if ( ! "SUCCESS" . equals ( status ) ) result = null ; } if ( status != null && result != null ) ar . set ( status + ":" + result ) ; stopTime = System . currentTimeMillis ( ) ; pm . worked ( STATUS_REQUEST_DELAY ) ; Activator . println ( "status=" + status ) ; Activator . println ( "result=" + result ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } if ( pm . isCanceled ( ) ) throw new InterruptedException ( "Operation canceled" ) ; } while ( ar . get ( ) == null && stopTime - startTime < STATUS_REQUEST_TIMEOUT ) ; pm . done ( ) ; Activator . println ( "\n----------------------------------\n" + "Job " + jobId + "\n" + title + "\ncompleted in " + ( stopTime - startTime ) / 1000.0 + " sec\n" + "Status: " + ar . get ( ) + "\n----------------------------------\n" ) ; } } ) ; } catch ( InvocationTargetException e ) { e . printStackTrace ( ) ; return null ; } return ar . get ( ) ; }
Sends a job status request to the KIE Server.

@param jobId - the job ID from a previous HTTP POST or DELETE request
@return a string composed of a status word (e.g. "SUCCESS" or
"BAD_REQUEST") followed by a colon delimiter and a detailed
message.
@throws IOException
Sends a job status request to the KIE Server .