Class DBPrepareProgressReporter
-
- All Implemented Interfaces:
public final class DBPrepareProgressReporterReads the preparation progress of the dbPrepare process running inside the container and reports it as a rendered progress bar.
The dbPrepare process exposes its progress as JMX attributes instead of writing them to its output, so that the progress cannot interfere with the log output. Unlike a locally started process, a process inside a container cannot be attached to by its process id, so it is read through the JMX connector of the container. The connector is enabled by the environment variable
ENABLE_JMX, see the entrypoint of the ICM-AS image.All errors are handled silently: the progress is purely informational and must never fail the build.
-
-
Constructor Summary
Constructors Constructor Description DBPrepareProgressReporter(String host, Integer port, Function1<String, Unit> onProgress)
-
Method Summary
Modifier and Type Method Description final Unitstart()Starts reading the progress in the background. final Unitstop()Stops reading the progress and releases the connection to the container. final static Stringrender(Integer percent, Integer processed, Integer total, String cartridge, String step)Renders the progress bar shown in Gradle's status line. -
-
Constructor Detail
-
DBPrepareProgressReporter
DBPrepareProgressReporter(String host, Integer port, Function1<String, Unit> onProgress)
- Parameters:
host- the host the JMX connector of the container is reachable atport- the port the JMX connector of the container is published toonProgress- consumer of the rendered progress bar
-
-
Method Detail
-
render
final static String render(Integer percent, Integer processed, Integer total, String cartridge, String step)
Renders the progress bar shown in Gradle's status line.
- Parameters:
percent- the progress in percentprocessed- the number of executed preparation stepstotal- the number of preparation steps expected to be executedcartridge- the path of the cartridge of the current step, may benullor emptystep- the name of the current step, may benullor empty- Returns:
the rendered progress bar
-
-
-
-