public class AgentRunner
extends java.lang.Object
implements java.lang.Runnable, java.lang.AutoCloseable
Agent and ensuring exceptions are handled.
Note: An agent runner should only be once per instance.
| Constructor and Description |
|---|
AgentRunner(IdleStrategy idleStrategy,
ErrorHandler errorHandler,
AtomicCounter errorCounter,
Agent agent)
Create an agent passing in
IdleStrategy |
| Modifier and Type | Method and Description |
|---|---|
Agent |
agent()
The
Agent who's lifecycle is being managed. |
void |
close()
Stop the running Agent and cleanup.
|
void |
run()
Run an
Agent. |
static void |
startOnThread(AgentRunner runner)
Start the given agent runner on a new thread.
|
public AgentRunner(IdleStrategy idleStrategy, ErrorHandler errorHandler, AtomicCounter errorCounter, Agent agent)
IdleStrategyidleStrategy - to use for Agent run looperrorHandler - to be called if an Throwable is encounterederrorCounter - for reporting how many exceptions have been seen.agent - to be run in this thread.public static void startOnThread(AgentRunner runner)
runner - the agent runner to startpublic Agent agent()
Agent who's lifecycle is being managed.Agent who's lifecycle is being managed.public void run()
run in interface java.lang.Runnablepublic final void close()
Agent performing
it Agent.onClose() logic.
The clean up logic will only be performed once even if close is called from multiple concurrent threads.
close in interface java.lang.AutoCloseableCopyright © 2014 - 2016 Real Logic Ltd. All Rights Reserved.