// Path: awex-core/src/main/java/com/raycoarana/awex/state/PoolState.java
// public interface PoolState {
//     QueueState getQueue(int queueId);
// 
//     Task getEqualTaskInQueue(Task task);
// }


import com.raycoarana.awex.state.PoolState;
    public abstract void onStartUp();

    /**
     * A new task is added to the pool. Policy must manage where the task will be executed,
     * could create new queues (@see createQueue), create new worker for that queues
     * (@see createWorker) and queue the task in any of the existing queues (@see queueTask).
     * Even if the task should be executed in real time, the policy could create an specialized
     * worker that will execute the work immediately (@see executeImmediately).
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
    public abstract void onTaskAdded(PoolState poolState, Task task);

    /**
     * Event dispatched when a task finishes. Policy could manage the state of the pool, reducing
     * the resources consumed by removing workers (@see removeWorker) or removing queues (@see remove
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
    public abstract void onTaskFinished(PoolState poolState, Task task);

    /**
     * Event dispatched when a task in a queue timeout. The task is removed from the queue and
     * it will not be executed again. It's policy responsibility to reschedule or cancel the task
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
// Path: awex-core/src/main/java/com/raycoarana/awex/state/PoolState.java
// public interface PoolState {
//     QueueState getQueue(int queueId);
// 
//     Task getEqualTaskInQueue(Task task);
// }


// Path: awex-core/src/main/java/com/raycoarana/awex/PoolPolicy.java
import com.raycoarana.awex.state.PoolState;

    public abstract void onStartUp();

    /**
     * A new task is added to the pool. Policy must manage where the task will be executed,
     * could create new queues (@see createQueue), create new worker for that queues
     * (@see createWorker) and queue the task in any of the existing queues (@see queueTask).
     * Even if the task should be executed in real time, the policy could create an specialized
     * worker that will execute the work immediately (@see executeImmediately).
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
    public abstract void onTaskAdded(PoolState poolState, Task task);

    /**
     * Event dispatched when a task finishes. Policy could manage the state of the pool, reducing
     * the resources consumed by removing workers (@see removeWorker) or removing queues (@see remove
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
    public abstract void onTaskFinished(PoolState poolState, Task task);

    /**
     * Event dispatched when a task in a queue timeout. The task is removed from the queue and
     * it will not be executed again. It's policy responsibility to reschedule or cancel the task
     *
     * @param poolState thread pool state
     * @param task task in queue that timed out
     */
    public abstract void onTaskQueueTimeout(PoolState poolState, Task task);