S
- the availability state typepublic class AvailabilityChangeEvent<S extends AvailabilityState>
extends org.springframework.context.ApplicationEvent
ApplicationEvent
sent when the AvailabilityState
of the application
changes.
Any application component can send such events to update the state of the application.
Constructor and Description |
---|
AvailabilityChangeEvent(java.lang.Object source,
S state)
Create a new
AvailabilityChangeEvent instance. |
Modifier and Type | Method and Description |
---|---|
S |
getState()
Return the changed availability state.
|
static <S extends AvailabilityState> |
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> |
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. |
public AvailabilityChangeEvent(java.lang.Object source, S state)
AvailabilityChangeEvent
instance.source
- the source of the eventstate
- the availability state (never null
)public S getState()
public static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationContext context, S state)
AvailabilityChangeEvent
to the given application context.S
- the availability state typecontext
- the context used to publish the eventstate
- the changed availability statepublic static <S extends AvailabilityState> void publish(org.springframework.context.ApplicationEventPublisher publisher, java.lang.Object source, S state)
AvailabilityChangeEvent
to the given application context.S
- the availability state typepublisher
- the publisher used to publish the eventsource
- the source of the eventstate
- the changed availability state