fr.cnes.sirius.validate.parallel
Class AbstractSimpleParallelTaskImpl

java.lang.Object
  extended by fr.cnes.sirius.validate.parallel.AbstractSimpleParallelTaskImpl
All Implemented Interfaces:
ParallelTask, Callable<ParallelResult>

public abstract class AbstractSimpleParallelTaskImpl
extends Object
implements ParallelTask

Simple, abstract implementation for a ParallelTask. Serves as a base for generic, simple implementations of ParallelTask, or as a starting example for other implementations. Provides simple implementations for getTaskLabel() and getTaskInfo(), which may be enough for most cases. The developer extending this class only needs to provide the callImpl() method.

Since:
1.2
Version:
$Id: AbstractSimpleParallelTaskImpl.java 13433 2015-05-19 12:04:49Z trapier $
Author:
cardosop
Concurrency :
unknown since it's abstract

Constructor Summary
protected AbstractSimpleParallelTaskImpl(int iid)
          Constructor with instance id parameter.
 
Method Summary
 ParallelResult call()
           
protected abstract  ParallelResult callImpl()
          Call implementation to be provided by the implementing class.
protected  String getCallThreadName()
           
 int getId()
           
 ParallelResult getResult()
          Asynchronous getter for the results.
 String getTaskInfo()
          Returns human-readable info on the status of the task.
 String getTaskLabel()
          Returns a label identifying the task "class".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSimpleParallelTaskImpl

protected AbstractSimpleParallelTaskImpl(int iid)
Constructor with instance id parameter.

Parameters:
iid - the instance id, an integer. Identifies the task instance in the getTaskInfo string, has otherwise no use.
Method Detail

getTaskLabel

public String getTaskLabel()
Description copied from interface: ParallelTask
Returns a label identifying the task "class". It's the same for all instances of the task.

Specified by:
getTaskLabel in interface ParallelTask
Returns:
the task label

getTaskInfo

public String getTaskInfo()
Description copied from interface: ParallelTask
Returns human-readable info on the status of the task. Is intended to change depending on the current state of the task.

Specified by:
getTaskInfo in interface ParallelTask
Returns:
the status of the task.

call

public ParallelResult call()
Specified by:
call in interface ParallelTask
Specified by:
call in interface Callable<ParallelResult>

callImpl

protected abstract ParallelResult callImpl()
Call implementation to be provided by the implementing class. The implementation only has to handle the task in itself, and returning the result (the result is saved by the base class).

Returns:
a ParallelResult instance

getResult

public ParallelResult getResult()
Description copied from interface: ParallelTask
Asynchronous getter for the results. Is meant to be called after call to call(), and call() has ended. Otherwise behavior is unpredictable.

Specified by:
getResult in interface ParallelTask
Returns:
the same ParallelResult object already returned by call()

getId

public int getId()
Returns:
the id

getCallThreadName

protected String getCallThreadName()
Returns:
the callThreadName


Copyright © 2016 CNES. All Rights Reserved.