Class GroomRuns
java.lang.Object
org.apache.juneau.petstore.console.ops.GroomRuns
- All Implemented Interfaces:
AutoCloseable
The groom-pet demo runs behind the Jobs page's terminal cards.
A run writes about 60 ANSI-styled lines to a MemoryTerminalSource, one step per tick: INFO and FINE lines
(FINE is dim), a WARNING, check/cross marks, a progress strip of coloured blocks, a multi-line
SEVERE entry, bold marker lines, and a canned ANSI transcript written as-is. Each tick also appends one ANSI line to
a temp file, read through one FileTerminalSource per run. A verbose run first writes 8000
FINE lines.
Run ids are random 128-bit hex strings, so a terminal can be read only by someone who was given its id.
Example:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Stops the ticker and deletes every run's file.latest()list()static GroomRunsseeded(long periodMs) Creates the runs and starts one verbose run, so the Jobs page always has a log to show.Resolves a terminal id:<runId>is the in-memory terminal,<runId>-filethe file source.Starts a run, or returns the run already started with the same idempotency key.
-
Field Details
-
PERIOD_PROPERTY
System property: milliseconds between steps.- See Also:
-
DEFAULT_PERIOD_MS
The default step period; 53 steps take about 35 seconds.- See Also:
-
FILE_SUFFIX
Suffix of the log id that selects a run's file-backed source.- See Also:
-
-
Constructor Details
-
GroomRuns
Constructor.- Parameters:
periodMs- Milliseconds between steps, at least 1.
-
-
Method Details
-
seeded
Creates the runs and starts one verbose run, so the Jobs page always has a log to show.- Parameters:
periodMs- Milliseconds between steps.- Returns:
- The runs.
-
start
Starts a run, or returns the run already started with the same idempotency key.- Parameters:
pet- The pet name; blank means"Rex".verbose- Whether to write 8000 FINE lines first.idempotencyKey- The client's key, ornull .- Returns:
- The run.
- Throws:
IOException- If the temp file cannot be created.
-
get
- Parameters:
id- A run id, ornull .- Returns:
- The run.
-
latest
- Returns:
- The newest run, or
null afterclose().
-
list
- Returns:
- The runs, newest first.
-
source
Resolves a terminal id:<runId>is the in-memory terminal,<runId>-filethe file source.- Parameters:
terminalId- The terminal id from the URL.- Returns:
- The source, or empty for an unknown id.
-
close
Stops the ticker and deletes every run's file.- Specified by:
closein interfaceAutoCloseable
-