All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tangosol.util.fsm.LifecycleAwareEvent Maven / Gradle / Ivy

There is a newer version: 24.09
Show newest version
/*
 * Copyright (c) 2000, 2020, Oracle and/or its affiliates.
 *
 * Licensed under the Universal Permissive License v 1.0 as shown at
 * http://oss.oracle.com/licenses/upl.
 */
package com.tangosol.util.fsm;

/**
 * A {@link LifecycleAwareEvent} is a specialized {@link Event} that
 * receives callbacks during the processing of the {@link Event} by
 * a {@link FiniteStateMachine}.
 *
 * @param   the type of state of a {@link FiniteStateMachine}
 *
 * @author Brian Oliver
 * @since Coherence 12.2.1
 */
public interface LifecycleAwareEvent> extends Event
    {
    /**
     * Called by a {@link FiniteStateMachine} when the {@link LifecycleAwareEvent}
     * is initially about to be accepted for processing.
     *
     * @param context  the {@link ExecutionContext} for the {@link Event}
     *
     * @return true if the {@link Event} should be accepted, or
     *         false if the {@link FiniteStateMachine} should
     *         ignore the {@link LifecycleAwareEvent}
     */
    public boolean onAccept(ExecutionContext context);

    /**
     * Called by a {@link FiniteStateMachine} when the {@link LifecycleAwareEvent}
     * is about to be processed.
     *
     * @param context  the {@link ExecutionContext} for the {@link Event}
     */
    public void onProcessing(ExecutionContext context);

    /**
     * Called by a {@link FiniteStateMachine} when the {@link LifecycleAwareEvent}
     * has been processed.
     *
     * @param context  the {@link ExecutionContext} for the {@link Event}
     */
    public void onProcessed(ExecutionContext context);
    }