Class CloudServiceLifecycleChangeEvent

java.lang.Object
eu.cloudnetservice.driver.event.Event
eu.cloudnetservice.driver.event.events.service.CloudServiceEvent
eu.cloudnetservice.driver.event.events.service.CloudServiceLifecycleChangeEvent

public final class CloudServiceLifecycleChangeEvent extends CloudServiceEvent
An event being fired when the lifecycle of a service changes. For example from running to stopped. Note that this event is not fired for all service state changes. For example when auto delete on stop is enabled for a service, this event will be fired for the change from running to deleted, but never from running to stopped nor from stopped to deleted.

This event is fired after the change of the lifecycle, the new lifecycle is already set in the associated service info.

This event is not called on the own node of the service.

Since:
4.0
  • Field Details

  • Constructor Details

    • CloudServiceLifecycleChangeEvent

      public CloudServiceLifecycleChangeEvent(@NonNull @NonNull ServiceLifeCycle lastLifeCycle, @NonNull @NonNull ServiceInfoSnapshot info)
      Constructs a new cloud service lifecycle event.
      Parameters:
      lastLifeCycle - the lifecycle of the service before changing to the new lifecycle.
      info - the service info associated with this event.
      Throws:
      NullPointerException - if either the last lifecycle or service info is null.
  • Method Details

    • lastLifeCycle

      @NonNull public @NonNull ServiceLifeCycle lastLifeCycle()
      Get the lifecycle the service was in before changing.
      Returns:
      the lifecycle the service was in before changing.
    • newLifeCycle

      @NonNull public @NonNull ServiceLifeCycle newLifeCycle()
      Get the lifecycle the service changed to. This lifecycle is already present in the service info associated with this event.

      This method call is equivalent to serviceInfo().lifeCycle().

      Returns:
      the lifecycle the service changed to.