Class AgentInterruptedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
madkit.kernel.AgentInterruptedException
- All Implemented Interfaces:
Serializable
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 Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
AgentInterruptedException
public AgentInterruptedException()
-