ibspan.ecap.merchant.shopdecisions.negotiationpreparation
Class PreparationTaskRunner

java.lang.Object
  extended by ibspan.ecap.merchant.shopdecisions.negotiationpreparation.PreparationTaskRunner

public class PreparationTaskRunner
extends java.lang.Object

A class responsible for running PreparationTasks and serving as a completion service providing methods to retrieve completed task results.

Author:
Micha³ Drozdowicz

Constructor Summary
PreparationTaskRunner()
           
 
Method Summary
 java.util.concurrent.Future<NegotiationDescription> runPreparationTask(PreparationTask task)
          Executes the specified task.
 NegotiationDescription takeResult()
          Performs a blocking receive of a finished task.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreparationTaskRunner

public PreparationTaskRunner()
Method Detail

takeResult

public NegotiationDescription takeResult()
                                  throws java.lang.InterruptedException,
                                         java.util.concurrent.ExecutionException
Performs a blocking receive of a finished task. Blocks the execution of the calling thread until a task completes and the result is available.

Returns:
the result of a completed task.
Throws:
java.lang.InterruptedException - when the calling thread has been interrupted while waiting for the result
java.util.concurrent.ExecutionException

runPreparationTask

public java.util.concurrent.Future<NegotiationDescription> runPreparationTask(PreparationTask task)
Executes the specified task.

Parameters:
task - the task to be executed
Returns:
the Future describing the future result of the task.