@Private
public class StartupProgress
extends java.lang.Object
Phase or Step within a phase. Additional methods provide ways
to associate a step or phase with optional information, such as a file name or
file size. It also provides counters, which can be incremented by the caller
to indicate progress through a long-running task.
This class is thread-safe. Any number of threads may call any methods, even
for the same phase or step, without risk of corrupting internal state. For
all begin/end methods and set methods, the last one in wins, overwriting any
prior writes. Instances of StartupProgress.Counter provide an atomic increment
operation to prevent lost updates.
After startup completes, the tracked data is frozen. Any subsequent updates
or counter increments are no-ops.
For read access, call createView() to create a consistent view with
a clone of the data.| Modifier and Type | Class | Description |
|---|---|---|
static interface |
StartupProgress.Counter |
Allows a caller to increment a counter for tracking progress.
|
| Constructor | Description |
|---|---|
StartupProgress() |
Creates a new StartupProgress by initializing internal data structure for
tracking progress of all defined phases.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
beginPhase(Phase phase) |
Begins execution of the specified phase.
|
void |
beginStep(Phase phase,
Step step) |
Begins execution of the specified step within the specified phase.
|
StartupProgressView |
createView() |
Creates a
StartupProgressView containing data cloned from this
StartupProgress. |
void |
endPhase(Phase phase) |
Ends execution of the specified phase.
|
void |
endStep(Phase phase,
Step step) |
Ends execution of the specified step within the specified phase.
|
StartupProgress.Counter |
getCounter(Phase phase,
Step step) |
Returns a counter associated with the specified phase and step.
|
Status |
getStatus(Phase phase) |
Returns the current run status of the specified phase.
|
void |
setCount(Phase phase,
Step step,
long count) |
Sets counter to the specified value.
|
void |
setFile(Phase phase,
java.lang.String file) |
Sets the optional file name associated with the specified phase.
|
void |
setSize(Phase phase,
long size) |
Sets the optional size in bytes associated with the specified phase.
|
void |
setTotal(Phase phase,
Step step,
long total) |
Sets the total associated with the specified phase and step.
|
public StartupProgress()
public void beginPhase(Phase phase)
phase - Phase to beginpublic void beginStep(Phase phase, Step step)
phase - Phase within which the step should be startedstep - Step to beginpublic void endPhase(Phase phase)
phase - Phase to endpublic void endStep(Phase phase, Step step)
phase - Phase within which the step should be endedstep - Step to endpublic Status getStatus(Phase phase)
phase - Phase to getpublic StartupProgress.Counter getCounter(Phase phase, Step step)
phase - Phase to getstep - Step to getpublic void setCount(Phase phase, Step step, long count)
phase - Phase to setstep - Step to setcount - long to setpublic void setFile(Phase phase, java.lang.String file)
phase - Phase to setfile - String file name to setpublic void setSize(Phase phase, long size)
phase - Phase to setsize - long to setpublic void setTotal(Phase phase, Step step, long total)
phase - Phase to setstep - Step to settotal - long to setpublic StartupProgressView createView()
StartupProgressView containing data cloned from this
StartupProgress. Subsequent updates to this StartupProgress will not be
shown in the view. This gives a consistent, unchanging view for callers
that need to perform multiple related read operations. Calculations that
require aggregation, such as overall percent complete, will not be impacted
by mutations performed in other threads mid-way through the calculation.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.