org.springframework.boot.availability

Class AvailabilityChangeEvent<S extends AvailabilityState>

  • java.lang.Object
    • java.util.EventObject
      • org.springframework.context.ApplicationEvent
        • org.springframework.context.PayloadApplicationEvent<S>
          • org.springframework.boot.availability.AvailabilityChangeEvent<S>
  • Type Parameters:
    S - the availability state type
    All Implemented Interfaces:
    java.io.Serializable, org.springframework.core.ResolvableTypeProvider


    public class AvailabilityChangeEvent<S extends AvailabilityState>
    extends org.springframework.context.PayloadApplicationEvent<S>
    ApplicationEvent sent when the AvailabilityState of the application changes.

    Any application component can send such events to update the state of the application.

    Since:
    2.3.0
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.EventObject

        source
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      org.springframework.core.ResolvableType getResolvableType() 
      S getState()
      Return the changed availability state.
      static <S extends AvailabilityState>
      void
      publish(org.springframework.context.ApplicationContext context, S state)
      Convenience method that can be used to publish an AvailabilityChangeEvent to the given application context.
      static <S extends AvailabilityState>
      void
      publish(org.springframework.context.ApplicationEventPublisher publisher, java.lang.Object source, S state)
      Convenience method that can be used to publish an AvailabilityChangeEvent to the given application context.
      • Methods inherited from class org.springframework.context.PayloadApplicationEvent

        getPayload
      • Methods inherited from class org.springframework.context.ApplicationEvent

        getTimestamp
      • Methods inherited from class java.util.EventObject

        getSource, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • AvailabilityChangeEvent

        public AvailabilityChangeEvent(java.lang.Object source,
                                       S state)
        Create a new AvailabilityChangeEvent instance.
        Parameters:
        source - the source of the event
        state - the availability state (never null)
    • Method Detail

      • getState

        public S getState()
        Return the changed availability state.
        Returns:
        the availability state
      • getResolvableType

        public org.springframework.core.ResolvableType getResolvableType()
        Specified by:
        getResolvableType in interface org.springframework.core.ResolvableTypeProvider
        Overrides:
        getResolvableType in class org.springframework.context.PayloadApplicationEvent<S extends AvailabilityState>
      • publish

        public static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationContext context,
                                                                 S state)
        Convenience method that can be used to publish an AvailabilityChangeEvent to the given application context.
        Type Parameters:
        S - the availability state type
        Parameters:
        context - the context used to publish the event
        state - the changed availability state
      • publish

        public static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationEventPublisher publisher,
                                                                 java.lang.Object source,
                                                                 S state)
        Convenience method that can be used to publish an AvailabilityChangeEvent to the given application context.
        Type Parameters:
        S - the availability state type
        Parameters:
        publisher - the publisher used to publish the event
        source - the source of the event
        state - the changed availability state