Class Lifecycle
- java.lang.Object
-
- ch.raffael.meldioc.library.base.lifecycle.Lifecycle
-
- Direct Known Subclasses:
Lifecycle.LegacyLifecycle
public class Lifecycle extends java.lang.ObjectA 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
All Methods Static Methods Instance Methods Concrete Methods 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)
-
-
-
Constructor Detail
-
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 Detail
-
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
public static Lifecycle of(Lifecycle.Feature lifecycleFeature)
-
nullShutdownActuator
public static ShutdownController.Actuator nullShutdownActuator()
-
onSuccess
public Lifecycle onSuccess(java.util.function.Consumer<? super Lifecycle.StartupSuccess> onSuccess)
-
onError
public Lifecycle onError(java.util.function.Consumer<? super Lifecycle.StartupError> onError)
-
log
public Lifecycle log(org.slf4j.Logger log)
-
asApplication
public Lifecycle asApplication(org.slf4j.Logger log)
-
asApplication
public Lifecycle asApplication(io.vavr.control.Option<? extends org.slf4j.Logger> log)
-
shutdownHook
public Lifecycle shutdownHook()
-
exitOnError
public Lifecycle exitOnError()
-
exitOnError
public Lifecycle exitOnError(int exitCode)
-
start
public Lifecycle.StartupResult start()
-
start
public Lifecycle.StartupResult start(long timeoutSeconds)
-
start
public Lifecycle.StartupResult start(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
-
shutdown
public io.vavr.collection.Seq<java.lang.Throwable> shutdown() throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
-