public abstract class AbstractBatchProgressMonitor extends Object implements IBatchProgressMonitorExt
Modifier and Type | Field and Description |
---|---|
protected List<AbstractBatchProgressMonitor> |
currentChildren |
protected Object |
currentItem
Current item being processed
|
protected boolean |
done |
protected Long |
endTime |
protected String |
executionId |
protected long |
itemCount |
protected AbstractBatchProgressMonitor |
parent |
protected List<String> |
rejectedItems |
protected long |
startTime |
protected List<String> |
successItems |
protected String |
taskName
Name of the task, set with beginTask
Init to null : cannot be set multiple times. beginTask will fail if
taskName is not null.
|
protected int |
totalWork |
protected int |
worked |
UNKNOW
Modifier | Constructor and Description |
---|---|
|
AbstractBatchProgressMonitor(String executionId,
IBatch batch)
Constructor used for main monitor.
|
protected |
AbstractBatchProgressMonitor(String executionId,
IBatchProgressMonitor parent,
int parentWork,
IBatch batch)
Protected constructor used to create a sub task.
|
Modifier and Type | Method and Description |
---|---|
void |
beginTask(String name,
String description,
int totalWork)
Begin a task execution.
|
IBatchProgressMonitor |
createSubTask(int work)
Create a sub task of this task with the amount of work the subtask
execution will done.
|
void |
done()
Set the task is done.
|
protected void |
endBatch(boolean success) |
protected void |
endTask(boolean success) |
void |
fail(String reason)
Report global failure.
|
void |
fail(String reason,
Throwable t)
Report global failure.
|
IBatch |
getBatch() |
Object |
getCurrentItem() |
protected Date |
getEndDate()
Returns end date is the task is finished, or an estimate if task is still
running.
|
long |
getItemCount() |
String |
getLastMessage() |
Date |
getLastUpdate() |
protected org.slf4j.Logger |
getLogger() |
protected AbstractBatchProgressMonitor |
getMainMonitor()
Get the top parent.
|
protected int |
getParentWork() |
float |
getProgress()
Get current progress.
|
List<String> |
getRejectedItems()
Get the list of rejected items.
|
protected Date |
getStartDate() |
String |
getTaskDescription() |
String |
getTaskGroup() |
String |
getTaskName() |
int |
getTotalWork()
Retrieve the total amount of work for this task.
|
long |
getWritingDelay() |
boolean |
isCancelRequested()
Returns true if cancel has been requested for the current job, usually
from a control UI.
|
boolean |
isDone() |
boolean |
isSuccess() |
void |
message(String message)
Send a message during the task execution.
|
protected abstract IBatchProgressMonitor |
newInstance(int work) |
protected void |
onBatchEnd() |
void |
reject(String[] itemIds,
String reason)
Reject a set of items during the task processing.
|
void |
reject(String[] itemIds,
String reason,
Throwable e)
Reject a set of items during the task processing.
|
void |
reject(String itemId,
String reason)
Reject one item during the task processing.
|
void |
reject(String itemId,
String reason,
Throwable e)
* Reject one item during the task processing.
|
void |
setCurrentItem(Object item)
Set the current item which is being processed.
|
void |
setLogger(org.slf4j.Logger loggerParam)
Set the logger to use for the current batch.
|
void |
setTotalWork(int totalWork) |
void |
setWritingDelay(long writingDelay)
Set the writing delay.
|
protected void |
touch()
Updated 'lastUpdate' value.
|
void |
worked(int work)
Notify the processing of items.
|
protected List<AbstractBatchProgressMonitor> currentChildren
protected Object currentItem
protected boolean done
protected Long endTime
protected final String executionId
protected long itemCount
protected AbstractBatchProgressMonitor parent
protected long startTime
protected String taskName
Init to null : cannot be set multiple times. beginTask will fail if taskName is not null.
protected int totalWork
protected int worked
public AbstractBatchProgressMonitor(String executionId, IBatch batch)
executionId
- job execution idprotected AbstractBatchProgressMonitor(String executionId, IBatchProgressMonitor parent, int parentWork, IBatch batch)
executionId
- execution idparent
- parent monitorparentWork
- parent amount of workpublic void beginTask(String name, String description, int totalWork)
beginTask
in interface IBatchProgressMonitor
name
- task namedescription
- task descriptiontotalWork
- task amount of work to be donepublic IBatchProgressMonitor createSubTask(int work)
createSubTask
in interface IBatchProgressMonitor
work
- work units of the task done by the subtaskpublic void done()
done
in interface IBatchProgressMonitor
protected void endBatch(boolean success)
protected void endTask(boolean success)
public void fail(String reason)
IBatchProgressMonitor
Use this when the batch has issued a major error and cannot continue.
fail
in interface IBatchProgressMonitor
public void fail(String reason, Throwable t)
IBatchProgressMonitor
Use this when the batch has issued a major error and cannot continue.
fail
in interface IBatchProgressMonitor
t
- Exception which caused the failure.public IBatch getBatch()
public Object getCurrentItem()
protected Date getEndDate()
public long getItemCount()
getItemCount
in interface IBatchProgressMonitorExt
public String getLastMessage()
getLastMessage
in interface IBatchProgressMonitorExt
public Date getLastUpdate()
getLastUpdate
in interface IBatchProgressMonitor
protected org.slf4j.Logger getLogger()
protected AbstractBatchProgressMonitor getMainMonitor()
protected int getParentWork()
public float getProgress()
IBatchProgressMonitorExt
getProgress
in interface IBatchProgressMonitorExt
public List<String> getRejectedItems()
protected Date getStartDate()
public String getTaskDescription()
public String getTaskGroup()
public String getTaskName()
public int getTotalWork()
getTotalWork
in interface IBatchProgressMonitor
getTotalWork
in interface IBatchProgressMonitorExt
public long getWritingDelay()
public boolean isCancelRequested()
IBatchProgressMonitor
isCancelRequested
in interface IBatchProgressMonitor
public boolean isDone()
public boolean isSuccess()
public void message(String message)
message
in interface IBatchProgressMonitor
message
- messageprotected abstract IBatchProgressMonitor newInstance(int work)
protected void onBatchEnd()
public void reject(String itemId, String reason)
Use this when :
reject
in interface IBatchProgressMonitor
itemId
- rejected item idreason
- the reasonIBatchProgressMonitor#reject(String, String, Throwable) can be used
to provide the exception which has caused the failure.
public void reject(String itemId, String reason, Throwable e)
reject
in interface IBatchProgressMonitor
e
- ExceptionIBatchProgressMonitor.reject(String, String)
public void reject(String[] itemIds, String reason)
reject
in interface IBatchProgressMonitor
itemIds
- Array of item ids rejectedreason
- the reasonIBatchProgressMonitor.reject(String, String)
public void reject(String[] itemIds, String reason, Throwable e)
reject
in interface IBatchProgressMonitor
e
- ExceptionIBatchProgressMonitor.reject(String, String)
public void setCurrentItem(Object item)
setCurrentItem
in interface IBatchProgressMonitor
item
- current processed itempublic void setLogger(org.slf4j.Logger loggerParam)
IBatchProgressMonitor
setLogger
in interface IBatchProgressMonitor
public void setTotalWork(int totalWork)
public void setWritingDelay(long writingDelay)
writingDelay
- writing delayprotected void touch()
public void worked(int work)
worked
in interface IBatchProgressMonitor
work
- items processedCopyright © 2010–2016. All rights reserved.