org.apfloat.samples
Class BackgroundOperation

java.lang.Object
  extended byorg.apfloat.samples.BackgroundOperation

public class BackgroundOperation
extends Object

Class for running an Operation in the background in a separate thread.

Version:
1.0
Author:
Mikko Tommila

Constructor Summary
BackgroundOperation(Operation operation)
          Runs an operation in the background in a separate thread.
 
Method Summary
 Object getResult()
          Get the result of the operation.
 boolean isFinished()
          Check if the operation has been completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackgroundOperation

public BackgroundOperation(Operation operation)
Runs an operation in the background in a separate thread. The thread is started immediately.

Parameters:
operation - The operation to execute.
Method Detail

isFinished

public boolean isFinished()
Check if the operation has been completed.

Returns:
true if the execution of the operation has been completed, otherwise false.

getResult

public Object getResult()
Get the result of the operation. This method blocks until the operation has been completed.

Returns:
Result of the operation.
Throws:
RuntimeException - If a RuntimeException was thrown by the executed operation, it's thrown by this method.