All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jclarion.clarion.test.WaitRunnable Maven / Gradle / Ivy

The newest version!
package org.jclarion.clarion.test;


public abstract class WaitRunnable implements Runnable 
{
	private boolean done;
	private Object result;

	@Override
	public final void run() 
	{
		result = doRun();
		synchronized(this) {
			done=true;
			notifyAll();
		}
	}
	
	public Object getResult()
	{
		synchronized(this) {
			while (!done) {
				try {
					wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
		return result;
	}
	
	public abstract Object doRun(); 

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy