Class EatWhatYouKill

  • All Implemented Interfaces:
    Runnable, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle, ExecutionStrategy

    @ManagedObject("eat what you kill execution strategy")
    public class EatWhatYouKill
    extends ContainerLifeCycle
    implements ExecutionStrategy, Runnable
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

    A strategy where the thread that produces will run the resulting task if it is possible to do so without thread starvation.

    This strategy preemptively dispatches a thread as a pending producer, so that when a thread produces a task it can immediately run the task and let the pending producer thread take over production. When operating in this way, the sub-strategy is called Execute Produce Consume (EPC).

    However, if the task produced uses the Invocable API to indicate that it will not block, then the strategy will run it directly, regardless of the presence of a pending producer thread and then resume production after the task has completed. When operating in this pattern, the sub-strategy is called ProduceConsume (PC).

    If there is no pending producer thread available and if the task has not indicated it is non-blocking, then this strategy will dispatch the execution of the task and immediately continue production. When operating in this pattern, the sub-strategy is called ProduceExecuteConsume (PEC).

    The EatWhatYouKill strategy is named after a hunting proverb, in the sense that one should kill(produce) only to eat(consume).