public class StatefulTaskProgressSink extends Object implements TaskProgressSink
TaskProgressSink
thats keeps track of progress. It keeps track of the last progress stored
sent. The actual reporting of progress will be made through another sink.NULL_SINK
Constructor and Description |
---|
StatefulTaskProgressSink(long minProgress,
long maxProgress,
long currentProgress,
TaskProgressSink delegateSink)
Create the sink.
|
StatefulTaskProgressSink(long minProgress,
long maxProgress,
TaskProgressSink delegateSink)
Create the sink.
|
Modifier and Type | Method and Description |
---|---|
static Collection<StatefulTaskProgressSink> |
createPercentageSinksForRange(long startRange,
long endRange,
int numberOfDivisions,
TaskProgressSink sink)
Return a collection of sinks that allows progress to be reported across the specified ragnge.
|
StepTaskProgressSink |
createStepSinkView(long length,
int numberOfActions)
Create a
StepTaskProgressSink that maps its progress onto a specific range of this
sink. |
StepTaskProgressSink |
createStepSinkView(long startProgress,
long length,
int numberOfActions)
Create a
StepTaskProgressSink that maps its progress onto a specific range of this
sink. |
long |
getMaxProgress() |
long |
getMinProgress() |
long |
getProgress() |
void |
makeProgress(long taskProgress,
String currentSubTask,
String message)
This method can be called to indicate that progress is being made by a
task.
|
void |
makeProgress(String currentSubTask,
String message)
Send a new progress message without changing the current task progress.
|
void |
makeProgressIncrement(long increment,
String currentSubTask,
String message)
This method can be called to indicate that progress is being made by a
task.
|
void |
setProgress(long currentProgress)
Set the progress stored in the sink.
|
public StatefulTaskProgressSink(long minProgress, long maxProgress, long currentProgress, TaskProgressSink delegateSink)
minProgress
- the smallest task progress that the sink can report.maxProgress
- the largest task progress that the sink can report.currentProgress
- the initial task progress stored within the sink.delegateSink
- the sink that will be used for reporting.public StatefulTaskProgressSink(long minProgress, long maxProgress, TaskProgressSink delegateSink)
minProgress
- the smallest task progress that the sink can report.maxProgress
- the largest task progress that the sink can report.delegateSink
- the sink that will be used for reporting.public void makeProgress(long taskProgress, String currentSubTask, String message)
makeProgress
in interface TaskProgressSink
taskProgress
- the current status of the task. This value will be clamped
between the minimum and maximum progress specified when the object is constructed.currentSubTask
- the name of the current sub task or null if there isn't onemessage
- an optional message about the progress or nullpublic void makeProgressIncrement(long increment, String currentSubTask, String message)
increment
- the amount to increment the current progress by.currentSubTask
- the name of the current sub task or null if there isn't onemessage
- an optional message about the progress or nullpublic void makeProgress(String currentSubTask, String message)
currentSubTask
- the name of the current sub task or null if there isn't onemessage
- an optional message about the progress or nullpublic StepTaskProgressSink createStepSinkView(long startProgress, long length, int numberOfActions)
StepTaskProgressSink
that maps its progress onto a specific range of this
sink. This can be used to keep track of a part of a task that is divided into a number of
smaller steps.startProgress
- the start of the range on this sink to map back to.length
- the length of the range on this sink the view will map back to.numberOfActions
- to number of steps the returned sink should work for.StepTaskProgressSink
that will publish its results in the specified
range of this sink.public StepTaskProgressSink createStepSinkView(long length, int numberOfActions)
StepTaskProgressSink
that maps its progress onto a specific range of this
sink. This can be used to keep track of a part of a task that is divided into a number of
smaller steps. The start of the range is taken to be the current progress stored in this
project.length
- the length of the range on this sink the view will map back to.numberOfActions
- to number of steps the returned sink should work for.StepTaskProgressSink
that will publish its results in the specified
range of this sink.public static Collection<StatefulTaskProgressSink> createPercentageSinksForRange(long startRange, long endRange, int numberOfDivisions, TaskProgressSink sink)
Collection projects = ...; IteratorsinkIterator = StatefulTaskProgressSink.createPercentageSinksForRange(0, 100, projects.size(), ...); for (project : projects) { migrateProject(projects, sinkIterator.next()); }
startRange
- start of the progress range to divide.endRange
- end of the progress range to divide.numberOfDivisions
- the number of intervals in the range.sink
- the sink used to report progress.public long getProgress()
public void setProgress(long currentProgress)
currentProgress
- the progress to store in sink.public long getMaxProgress()
public long getMinProgress()
Copyright © 2002-2021 Atlassian. All Rights Reserved.