package com.hammurapi.common.concurrent;

/**
 * Synchronization interface.
 * @author Pavel Vlasov
 *
 */
public interface AsynchronousProcessor {

	/**
	 * Semantics of this method is similar to Thread.join() - this
	 * method blocks if the processor is working active tasks and
	 * unblocks when all work is done. 
	 * @throws InterruptedException
	 */
	void join() throws InterruptedException;
	
	/**
	 * Waits for the processor to finish work for specified time.
	 * @param timeout
	 * @return true if all work was finished.
	 * @throws InterruptedException
	 */
	boolean join(long timeout) throws InterruptedException;
}
