Class Lifecycle
java.lang.Object
ch.raffael.meldioc.library.base.lifecycle.Lifecycle
- Direct Known Subclasses:
Lifecycle.LegacyLifecycle
public class Lifecycle
extends java.lang.Object
A helper class to manage context lifecycle with features supporting
applications.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLifecycle.Featurestatic classLifecycle.LegacyLifecycleDeprecated, for removal: This API element is subject to removal in a future version.classLifecycle.StartupErrorclassLifecycle.StartupResultclassLifecycle.StartupSuccess -
Constructor Summary
Constructors Modifier Constructor Description protectedLifecycle(java.util.function.Supplier<? extends io.vavr.collection.Traversable<? extends io.vavr.CheckedRunnable>> startupActions, java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, java.util.function.Supplier<? extends ShutdownController.Actuator> shutdownActuator, java.time.Instant createTimestamp) -
Method Summary
Modifier and Type Method Description LifecycleasApplication(io.vavr.control.Option<? extends org.slf4j.Logger> log)LifecycleasApplication(org.slf4j.Logger log)LifecycleexitOnError()LifecycleexitOnError(int exitCode)Lifecyclelog(org.slf4j.Logger log)static ShutdownController.ActuatornullShutdownActuator()static Lifecycleof(Lifecycle.Feature lifecycleFeature)static Lifecycleof(ThreadingFeature threadingFeature, StartupActions.Feature startupActionsFeature, ShutdownFeature.WithActuator shutdownFeature)static Lifecycleof(java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, StartupActions.Feature startupActionsFeature, ShutdownFeature.WithActuator shutdownFeature)static Lifecycleof(java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, java.util.function.Supplier<? extends io.vavr.collection.Traversable<? extends io.vavr.CheckedRunnable>> startupActions, java.util.function.Supplier<? extends ShutdownController.Actuator> shutdownActuator)LifecycleonError(java.util.function.Consumer<? super Lifecycle.StartupError> onError)LifecycleonSuccess(java.util.function.Consumer<? super Lifecycle.StartupSuccess> onSuccess)io.vavr.collection.Seq<java.lang.Throwable>shutdown()LifecycleshutdownHook()Lifecycle.StartupResultstart()Lifecycle.StartupResultstart(long timeoutSeconds)Lifecycle.StartupResultstart(long timeout, java.util.concurrent.TimeUnit timeoutUnit)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Lifecycle
protected Lifecycle(java.util.function.Supplier<? extends io.vavr.collection.Traversable<? extends io.vavr.CheckedRunnable>> startupActions, java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, java.util.function.Supplier<? extends ShutdownController.Actuator> shutdownActuator, java.time.Instant createTimestamp)
-
-
Method Details
-
of
public static Lifecycle of(java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, java.util.function.Supplier<? extends io.vavr.collection.Traversable<? extends io.vavr.CheckedRunnable>> startupActions, java.util.function.Supplier<? extends ShutdownController.Actuator> shutdownActuator) -
of
public static Lifecycle of(java.util.function.Supplier<? extends java.util.concurrent.Executor> executor, StartupActions.Feature startupActionsFeature, ShutdownFeature.WithActuator shutdownFeature) -
of
public static Lifecycle of(ThreadingFeature threadingFeature, StartupActions.Feature startupActionsFeature, ShutdownFeature.WithActuator shutdownFeature) -
of
-
nullShutdownActuator
-
onSuccess
public Lifecycle onSuccess(java.util.function.Consumer<? super Lifecycle.StartupSuccess> onSuccess) -
onError
-
log
-
asApplication
-
asApplication
-
shutdownHook
-
exitOnError
-
exitOnError
-
start
-
start
-
start
-
shutdown
public io.vavr.collection.Seq<java.lang.Throwable> shutdown() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-