- Type Parameters:
T
- the module type
A module wrapper which starts a module as an application and stops it when the application is gracefully shutdown. An application basically provides boiler plate code to properly run a module as an application.
An application can display a Banner
when it starts. By default, the StandardBanner
is displayed.
An application also registers a virtual-machine shutdown hook that gracefully stops the module when the virtual machine shuts down.
A pidfile can also be created after the application has started and removed after the application has shutdown gracefully. by specifying the path to the pidfile in the "inverno.application.pid_file" system property. By default no pidfile is created. An application will fail to start if a pidfile designating a valid process already exists.
- Since:
- 1.0
- Author:
- Jeremy Kuhn
-
Constructor Summary
ModifierConstructorDescriptionprotected
Application
(Module.ModuleBuilder<T> moduleBuilder) Creates a new Application for the module created with the specified builder. -
Method Summary
Modifier and TypeMethodDescriptionSets the application banner.run()
Runs the application.static <E extends Module>
Erun
(Module.ModuleBuilder<E> moduleBuilder) Creates and run a new application for the module created with the specified builder.static <E extends Module>
Application<E> with
(Module.ModuleBuilder<E> moduleBuilder) Creates a new application for the module created with the specified builder.
-
Constructor Details
-
Application
Creates a new Application for the module created with the specified builder.
- Parameters:
moduleBuilder
- the module builder.
-
-
Method Details
-
with
Creates a new application for the module created with the specified builder.
- Type Parameters:
E
- the module type.- Parameters:
moduleBuilder
- the module builder.- Returns:
- an application.
-
run
Creates and run a new application for the module created with the specified builder.
- Type Parameters:
E
- the module type.- Parameters:
moduleBuilder
- the module builder.- Returns:
- a running module instance.
-
banner
Sets the application banner.
If null is specified no banner will be displayed
- Parameters:
banner
- the banner to set or null to display no banner.- Returns:
- this application.
-
run
Runs the application.
- Returns:
- the resulting module.
- Throws:
IllegalStateException
- if the application is already running.
-