Class AgentInterruptedException

All Implemented Interfaces:
Serializable

public class AgentInterruptedException extends RuntimeException
This exception is thrown when an agent is interrupted by an InterruptedException while executing a task which is able to react to this exception.

This includes all blocking methods that can be interrupted by a call to Thread.interrupt(). So, agent methods which are blocking by nature such as Agent.waitNextMessage() or Agent.pause(int) can throw this exception, for instance when the agent is killed.

In a non blocking context, an agent can react to an InterruptedException by calling Agent.exitOnKill(). For instance, if an agent perform heavy tasks in a loop, it should regularly check if it has been interrupted. Using Agent.exitOnKill() enables the agent to exit cleanly when interrupted. Especially, when the agent is interrupted while performing Agent.onLive(), it will exit it and perform Agent.onEnd() before exiting.

See Also:
  • Constructor Details

    • AgentInterruptedException

      public AgentInterruptedException()