Martini package lifecycle
Every Martini package has a state. A package's state can only be changed when a package is unloaded, loaded, started, or stopped; or in other words: when a lifecycle operation occurs. States impact how packages behave in an instance, and their ability to interact with other packages. Depending on the current state of a package, some actions may or may not be performed. For instance, deleting a package is not possible unless the package is unloaded.
States
The following list describes all possible package states:
-
UNLOADED
The state of a package that is not loaded in Martini. Effectively, this means the package does not exist in the Martini ecosystem; and it will be this way until it is loaded. ClassLoaders, FluxLoaders, GloopLoaders, and other similar components are unavailable in this state.
-
LOADING
The state of packages that are currently in the process of loading.
-
LOADED
The state of a package that is loaded. The application components of loaded packages will be available for use. This means you will be able to invoke services from a loaded package. Dependent packages will also be able to access the services of a loaded package.
HTTP endpoints such as those created by Gloop APIs, ad hoc services, Groovy controllers, and Martini endpoints will still be unreachable. These endpoints will only be available once a Martini package is started.
-
LOAD_FAILED
The state of a package that has failed to load. Similar to unloaded packages, the functionality of packages in this state are unavailable for use.
-
UNLOADING
The state of a package that is currently in the process of unloading.
-
STARTING
The state of a package that is currently in the process of starting.
-
STARTED
The state of a package that is currently running. All classes and services, HTTP endpoints, Solr cores, and Martini endpoints are available.
-
START_FAILED
The state of a package that has failed to start. Packages in this state are equivalent to loaded packages.
-
STOPPING
The status of a package that is currently in the process of stopping. Once a package is stopped, the state will return to
LOADED
.
Transitioning states
A package's state cannot be set manually; its value solely depends on what the
PackageManager
assigns. In order to
transition a package to another state, follow the steps below:
- If you want to start or stop multiple packages all at once, select the packages from the Navigator. Hold whilst clicking on the packages or use the key to select multiple adjacent packages.
- Right click on the package you want to start or stop. If you've selected multiple packages, right clicking on any one of them will suffice.
- Select Start, Stop, Load, or Unload. Options available depend on the current state of your package(s).
If the package you want to transition has packages that depend on it or is dependent on other packages, Martini will perform extra steps to ensure it satisfies the dependency requirements of all related packages:
- If called to start, Martini will attempt to start the package dependencies of the dependent package first before starting the package itself.
- If called to stop, Martini will attempt to stop the packages dependent on the target package first before stopping itself.
- If called to load, Martini will attempt to load the package dependencies of the dependent package first before loading the package itself.
- If called to unload, Martini will attempt to unload the packages dependent on the target package first before
unloading itself. If the target package's state is
STARTED
, it will attempt to stop the package first before unloading.
Features available on states
Feature | UNLOADED | LOADED | STARTED |
---|---|---|---|
Martini endpoints | ❌ | ❌ | ✅ |
Java classloader | ❌ | ✅ | ✅ |
Gloop classloader | ❌ | ✅ | ✅ |
Flux classloader | ❌ | ✅ | ✅ |
Groovy extension modules | ❌ | ✅ | ✅ |
Groovy compiler engine | ❌ | ✅ | ✅ |
Service invocation | ❌ | ✅ | ✅ |
Indexing for IDE search | ❌ | ✅ | ✅ |
Package cache manager | ❌ | ✅ | ✅ |
Solr client | ❌ | ❌ | ✅ |
Spring context | ❌ | ❌ | ✅ |
Web applications | ❌ | ❌ | ✅ |
REST and SOAP APIs | ❌ | ❌ | ✅ |
Configuring the package start-up state
Martini, when it starts up, automatically transitions all packages to their configured state on startup. To configure this property, select the state you want for your package using the State on Startup dropdown in the Package configuration editor.
Auto-unload
When Martini shuts down, it also unloads all packages if they aren't already unloaded.