ox.OxApp
See theOxApp companion object
trait OxApp
Extend this trait when defining application entry points. Comes in several variants:
- OxApp.Simple for applications which don't use command-line arguments
- OxApp for applications which use command-line arguments
- OxApp.WithEitherErrors to be able to unwrap
Either
s (see either.apply) in the entry point's body. If case of failure, the applications ends with an error - OxApp.WithErrorMode to report errors (which end the application) using other ErrorModes
The benefit of using OxApp
compared to normal @main
methods is that application interruptions is handled properly. A fork in a scope is created to run the application's logic. Interrupting the application (by sending SIGINT/SIGTERM, e.g. using CTRL+C) will cause the scope to end and all forks to be interrupted, allowing for a clean shutdown.
That way, any resources that have been allocated and attached to scopes, or that are managed using try-finally
blocks inside forks, will be released properly.
Certain aspects of exception handling can be configured using OxApp.Settings and overriding the settings
method.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Members list
In this article