Package io.micronaut.crac
Class CracEventPublisher
java.lang.Object
io.micronaut.crac.CracEventPublisher
A helper bean to assist in publishing the correct CRaC events when a checkpoint is taken or restored.
- Since:
- 1.0.0
- Author:
- Tim Yates
-
Constructor Summary
ConstructorDescriptionCracEventPublisher
(CracConfiguration cracConfiguration, io.micronaut.context.event.ApplicationEventPublisher<BeforeCheckpointEvent> beforeCheckpointEventPublisher, io.micronaut.context.event.ApplicationEventPublisher<AfterRestoreEvent> afterRestoreEventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionvoid
fireAfterRestoreEvents
(@NonNull OrderedResource resource, @NonNull LongSupplier action) Fires anAfterRestoreEvent
event.void
fireAfterRestoreEvents
(OrderedResource resource) Fires anAfterRestoreEvent
event with no action to be performed.void
fireBeforeCheckpointEvents
(@NonNull OrderedResource resource) Fires aBeforeCheckpointEvent
event with no action to be performed.void
fireBeforeCheckpointEvents
(@NonNull OrderedResource resource, @NonNull LongSupplier action) Fires aBeforeCheckpointEvent
event.
-
Constructor Details
-
CracEventPublisher
public CracEventPublisher(CracConfiguration cracConfiguration, io.micronaut.context.event.ApplicationEventPublisher<BeforeCheckpointEvent> beforeCheckpointEventPublisher, io.micronaut.context.event.ApplicationEventPublisher<AfterRestoreEvent> afterRestoreEventPublisher) - Parameters:
cracConfiguration
- The CRaC configuration.beforeCheckpointEventPublisher
- The publisher forBeforeCheckpointEvent
events.afterRestoreEventPublisher
- The publisher forAfterRestoreEvent
events.
-
-
Method Details
-
fireBeforeCheckpointEvents
public void fireBeforeCheckpointEvents(@NonNull @NonNull OrderedResource resource, @NonNull @NonNull LongSupplier action) Fires aBeforeCheckpointEvent
event.- Parameters:
resource
- The @{link OrderedResource} that is being checkpointed.action
- The action to perform that returns the time taken in nanoseconds.
-
fireBeforeCheckpointEvents
Fires aBeforeCheckpointEvent
event with no action to be performed.- Parameters:
resource
- The @{link OrderedResource} that is being checkpointed.
-
fireAfterRestoreEvents
public void fireAfterRestoreEvents(@NonNull @NonNull OrderedResource resource, @NonNull @NonNull LongSupplier action) Fires anAfterRestoreEvent
event.- Parameters:
resource
- The @{link OrderedResource} that is being restored.action
- The action to perform that returns the time taken in nanoseconds.
-
fireAfterRestoreEvents
Fires anAfterRestoreEvent
event with no action to be performed.- Parameters:
resource
- The @{link OrderedResource} that is being restored.
-