Class ReloadReport
The framework hands a fresh report to UltiToolsPlugin.onReload(ReloadReport) on every
reload. A module whose reload completed only in part records each part it could not reload with
partial(String) and returns normally. /ul reload <name> then tells the sender
which parts did not reload, and a full /ul reload lists the module with those parts in
its summary, instead of reporting an unconditional success. The framework's own reload log line
for the module says the same.
The framework records the parts of its own reload steps that did not take effect in the same
report, before the hook runs: a config-bound @Scheduled or @CmdCD value it refused
and kept, or a binding step that failed (#595).
Record a part and carry on when the rest of the module still works. Throw instead when the reload
cannot continue at all: reloadSelf() then logs a failure line naming the module,
/ul reload <name> replies failure, and a full /ul reload carries on with the next
module and names this one as failed.
@Override
protected void onReload(ReloadReport report) {
for (String service : services) {
try {
restart(service);
} catch (RuntimeException e) {
getLogger().error(e, "Could not restart " + service);
report.partial(service + " did not restart: " + e.getMessage());
}
}
}
A report is safe to write from more than one thread. Readers get immutable snapshots. The
framework creates one per reload with the public no-argument constructor; a module's own test
may create one the same way to call its onReload(ReloadReport) directly.
- Since:
- 6.3.0
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringRecorded in place of a missing or blank reason, so the reload is still reported as partial. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe parts reported as not reloaded, in the order they were recorded.booleanWhether any part of this reload was reported as not reloaded.voidRecords one part of this reload that did not reload.
-
Field Details
-
UNSPECIFIED_REASON
Recorded in place of a missing or blank reason, so the reload is still reported as partial.- See Also:
-
partialReasons
-
-
Constructor Details
-
ReloadReport
public ReloadReport()
-
-
Method Details
-
partial
Records one part of this reload that did not reload.- Parameters:
reason- what did not reload and, if known, why -- shown to the operator as written; anullor blank reason is recorded as "(no reason given)"
-
isPartial
public boolean isPartial()Whether any part of this reload was reported as not reloaded.- Returns:
trueifpartial(String)was called at least once
-
getPartialReasons
The parts reported as not reloaded, in the order they were recorded.- Returns:
- an immutable snapshot; later calls to
partial(String)do not change it
-