net.sf.mybatchfwk.history
Class MemoryExecutionHistory

java.lang.Object
  extended by net.sf.mybatchfwk.history.MemoryExecutionHistory
All Implemented Interfaces:
IExecutionHistory

public class MemoryExecutionHistory
extends java.lang.Object
implements IExecutionHistory

This implementation store the ids into the memory.
Warning:
- the number of ids stored must be very limited, in order to prevents OutOfMemoryError.
- there is no persistence, so the ids are lost when the batch is stopped.

Author:
Jérôme Bertèche (cyberteche@users.sourceforge.net)

Field Summary
protected  java.util.List<java.lang.String> completedTasksList
           
protected  java.util.List<java.lang.String> failedTasksList
           
 
Constructor Summary
MemoryExecutionHistory()
           
 
Method Summary
 void closeStorage()
          Close the storage system (called one time at the end of the batch)
 java.util.Iterator completedTasksIdIterator()
          Return an iterator over the id of the completed tasks
 java.util.Iterator failedTasksIdIterator()
          Return an iterator over the id of the completed tasks
 void initStorage(BatchConfiguration configuration)
          Init the storage system (called one time at the beginning of the batch)
 boolean isCompletedTask(java.lang.String id)
          Return true is this task has already been executed and completed
 boolean isFailedTask(java.lang.String id)
          Return true is this task has already been executed but failed
 void storeCompletedTaskId(java.lang.String id)
          Store the id of the completed task
 void storeFailedTaskId(java.lang.String id)
          Store the id of the failed task
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

completedTasksList

protected java.util.List<java.lang.String> completedTasksList

failedTasksList

protected java.util.List<java.lang.String> failedTasksList
Constructor Detail

MemoryExecutionHistory

public MemoryExecutionHistory()
Method Detail

initStorage

public void initStorage(BatchConfiguration configuration)
                 throws BatchException
Description copied from interface: IExecutionHistory
Init the storage system (called one time at the beginning of the batch)

Specified by:
initStorage in interface IExecutionHistory
Parameters:
configuration - the configuration of the batch
Throws:
BatchException

closeStorage

public void closeStorage()
                  throws BatchException
Description copied from interface: IExecutionHistory
Close the storage system (called one time at the end of the batch)

Specified by:
closeStorage in interface IExecutionHistory
Throws:
BatchException

completedTasksIdIterator

public java.util.Iterator completedTasksIdIterator()
                                            throws BatchException
Description copied from interface: IExecutionHistory
Return an iterator over the id of the completed tasks

Specified by:
completedTasksIdIterator in interface IExecutionHistory
Returns:
Throws:
BatchException

failedTasksIdIterator

public java.util.Iterator failedTasksIdIterator()
                                         throws BatchException
Description copied from interface: IExecutionHistory
Return an iterator over the id of the completed tasks

Specified by:
failedTasksIdIterator in interface IExecutionHistory
Returns:
Throws:
BatchException

isCompletedTask

public boolean isCompletedTask(java.lang.String id)
                        throws BatchException
Description copied from interface: IExecutionHistory
Return true is this task has already been executed and completed

Specified by:
isCompletedTask in interface IExecutionHistory
Parameters:
id - the id a a task
Throws:
BatchException

isFailedTask

public boolean isFailedTask(java.lang.String id)
                     throws BatchException
Description copied from interface: IExecutionHistory
Return true is this task has already been executed but failed

Specified by:
isFailedTask in interface IExecutionHistory
Throws:
BatchException

storeCompletedTaskId

public void storeCompletedTaskId(java.lang.String id)
                          throws BatchException
Description copied from interface: IExecutionHistory
Store the id of the completed task

Specified by:
storeCompletedTaskId in interface IExecutionHistory
Throws:
BatchException

storeFailedTaskId

public void storeFailedTaskId(java.lang.String id)
                       throws BatchException
Description copied from interface: IExecutionHistory
Store the id of the failed task

Specified by:
storeFailedTaskId in interface IExecutionHistory
Throws:
BatchException


Copyright © 2006 null. All Rights Reserved.