Package com.github.jpmsilva.jsystemd
Class PhaseStatusProvider
java.lang.Object
com.github.jpmsilva.jsystemd.PhaseStatusProvider
- All Implemented Interfaces:
StatusProvider
Implementation of
StatusProvider whose status is set by the application, to report what it is doing, such as Reindexing 40% or
Migrating the schema.
The status is shown as set, until it is set again or cleared. While there is no phase, nothing is reported.
When created with immediate updates, every change of phase is sent to systemd right away, rather than with the next status update.
- Author:
- Joao Silva
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PhaseStatusProvider, whose changes of phase are sent to systemd with the next status update.PhaseStatusProvider(boolean immediateUpdates) Create a new PhaseStatusProvider, whose changes of phase are sent to systemd either right away or with the next status update. -
Method Summary
-
Constructor Details
-
PhaseStatusProvider
public PhaseStatusProvider()Create a new PhaseStatusProvider, whose changes of phase are sent to systemd with the next status update. -
PhaseStatusProvider
public PhaseStatusProvider(boolean immediateUpdates) Create a new PhaseStatusProvider, whose changes of phase are sent to systemd either right away or with the next status update.The created instance is not registered as a status provider of
Systemd.instance(): that is up to the caller.- Parameters:
immediateUpdates-trueto send the status to systemd on every change of phase, orfalseto wait for the next status update
-
-
Method Details
-
getPhase
Returns the current phase.- Returns:
- the current phase, or
nullif there is none
-
setPhase
Sets the current phase, which is shown as is in the status.- Parameters:
phase- the current phase, ornull(or an empty string) to clear it
-
clearPhase
public void clearPhase()Clears the current phase, so that nothing is reported. -
status
Description copied from interface:StatusProviderExposes status information to send to systemd.- Specified by:
statusin interfaceStatusProvider- Returns:
- the string message to add to the service status
-