java.lang.Object
org.eclipse.jgit.lib.BatchingProgressMonitor
- All Implemented Interfaces:
ProgressMonitor
- Direct Known Subclasses:
TextProgressMonitor
ProgressMonitor that batches update events.
-
Field Summary
Fields inherited from interface org.eclipse.jgit.lib.ProgressMonitor
UNKNOWN
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
appendDuration
(StringBuilder s, Duration duration) Append formatted duration if system property or environment variable GIT_TRACE_PERFORMANCE is set to "true".void
Begin processing a single task.void
endTask()
Finish the current task, so the next can begin.boolean
Check for user task cancellation.protected abstract void
Finish the progress monitor when the total is known in advance.protected abstract void
Finish the progress monitor when the total wasn't known in advance.protected abstract void
Update the progress monitor when the total is known in advance.protected abstract void
Update the progress monitor if the total work isn't known,void
setDelayStart
(long time, TimeUnit unit) Set an optional delay before the first output.void
showDuration
(boolean enabled) Set whether the monitor should show elapsed time per taskvoid
start
(int totalTasks) Advise the monitor of the total number of subtasks.void
update
(int completed) Denote that some work units have been completed.
-
Constructor Details
-
BatchingProgressMonitor
public BatchingProgressMonitor()
-
-
Method Details
-
setDelayStart
Set an optional delay before the first output.- Parameters:
time
- how long to wait before output. If 0 output begins on the firstupdate(int)
call.unit
- time unit oftime
.
-
start
public void start(int totalTasks) Description copied from interface:ProgressMonitor
Advise the monitor of the total number of subtasks.This should be invoked at most once per progress monitor interface.
- Specified by:
start
in interfaceProgressMonitor
- Parameters:
totalTasks
- the total number of tasks the caller will need to complete their processing.
-
beginTask
Description copied from interface:ProgressMonitor
Begin processing a single task.- Specified by:
beginTask
in interfaceProgressMonitor
- Parameters:
title
- title to describe the task. Callers should publish these as stable string constants that implementations could match against for translation support.work
- total number of work units the application will perform;ProgressMonitor.UNKNOWN
if it cannot be predicted in advance.
-
update
public void update(int completed) Description copied from interface:ProgressMonitor
Denote that some work units have been completed.This is an incremental update; if invoked once per work unit the correct value for our argument is
1
, to indicate a single unit of work has been finished by the caller.- Specified by:
update
in interfaceProgressMonitor
- Parameters:
completed
- the number of work units completed since the last call.
-
endTask
public void endTask()Description copied from interface:ProgressMonitor
Finish the current task, so the next can begin.- Specified by:
endTask
in interfaceProgressMonitor
-
isCancelled
public boolean isCancelled()Description copied from interface:ProgressMonitor
Check for user task cancellation.- Specified by:
isCancelled
in interfaceProgressMonitor
- Returns:
- true if the user asked the process to stop working.
-
showDuration
public void showDuration(boolean enabled) Description copied from interface:ProgressMonitor
Set whether the monitor should show elapsed time per task- Specified by:
showDuration
in interfaceProgressMonitor
- Parameters:
enabled
- whether to show elapsed time per task
-
onUpdate
Update the progress monitor if the total work isn't known,- Parameters:
taskName
- name of the task.workCurr
- number of units already completed.duration
- how long this task runs- Since:
- 6.5
-
onEndTask
Finish the progress monitor when the total wasn't known in advance.- Parameters:
taskName
- name of the task.workCurr
- total number of units processed.duration
- how long this task runs- Since:
- 6.5
-
onUpdate
protected abstract void onUpdate(String taskName, int workCurr, int workTotal, int percentDone, Duration duration) Update the progress monitor when the total is known in advance.- Parameters:
taskName
- name of the task.workCurr
- number of units already completed.workTotal
- estimated number of units to process.percentDone
-workCurr * 100 / workTotal
.duration
- how long this task runs- Since:
- 6.5
-
onEndTask
protected abstract void onEndTask(String taskName, int workCurr, int workTotal, int percentDone, Duration duration) Finish the progress monitor when the total is known in advance.- Parameters:
taskName
- name of the task.workCurr
- total number of units processed.workTotal
- estimated number of units to process.percentDone
-workCurr * 100 / workTotal
.duration
- duration of the task- Since:
- 6.5
-
appendDuration
Append formatted duration if system property or environment variable GIT_TRACE_PERFORMANCE is set to "true". If both are defined the system property takes precedence.- Parameters:
s
- StringBuilder to append the formatted duration toduration
- duration to format- Since:
- 6.5
-