Class AgentsDaemon
- java.lang.Object
-
- org.apache.manifoldcf.agents.system.AgentsDaemon
-
public class AgentsDaemon extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AgentsDaemon.AgentsShutdownHook
Agents shutdown hook classprotected class
AgentsDaemon.AgentsThread
Agents thread.protected static class
AgentsDaemon.CleanupAgent
Agent cleanup class.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
_rcsid
static java.lang.String
agentServicePrefix
Agent service name prefix (followed by agent class name)static java.lang.String
agentShutdownSignal
Agent shutdown signal nameprotected AgentsDaemon.AgentsThread
agentsThread
The agents thread, which starts and stops agents daemons to keep them consistent with the database, and also takes on process cleanup where necessary.protected IdleCleanupThread
idleCleanupThread
The idle cleanup thread.protected java.lang.String
processID
Process ID for this agents daemon.protected java.util.Map<java.lang.String,IAgent>
runningHash
This is the place we keep track of the agents we've started.
-
Constructor Summary
Constructors Constructor Description AgentsDaemon(java.lang.String processID)
Create an agents daemon object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
assertAgentsShutdownSignal(IThreadContext threadContext)
Assert shutdown signal for the current agents daemon.protected void
checkAgents(IThreadContext threadContext)
Start all not-running agents.static void
clearAgentsShutdownSignal(IThreadContext threadContext)
Clear shutdown signal for the current agents daemon.protected static java.lang.String
getAgentsClassServiceType(java.lang.String agentClassName)
void
registerAgentsShutdownHook(IThreadContext threadContext)
Register agents shutdown hook.void
runAgents(IThreadContext threadContext)
Run agents process.void
startAgents(IThreadContext threadContext)
Start agents thread for this agents daemon object.void
stopAgents(IThreadContext threadContext)
Stop all started agents running under this agents daemon.
-
-
-
Field Detail
-
_rcsid
public static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
agentShutdownSignal
public static final java.lang.String agentShutdownSignal
Agent shutdown signal name- See Also:
- Constant Field Values
-
agentServicePrefix
public static final java.lang.String agentServicePrefix
Agent service name prefix (followed by agent class name)- See Also:
- Constant Field Values
-
agentsThread
protected AgentsDaemon.AgentsThread agentsThread
The agents thread, which starts and stops agents daemons to keep them consistent with the database, and also takes on process cleanup where necessary.
-
idleCleanupThread
protected IdleCleanupThread idleCleanupThread
The idle cleanup thread.
-
processID
protected final java.lang.String processID
Process ID for this agents daemon.
-
runningHash
protected final java.util.Map<java.lang.String,IAgent> runningHash
This is the place we keep track of the agents we've started.
-
-
Method Detail
-
assertAgentsShutdownSignal
public static void assertAgentsShutdownSignal(IThreadContext threadContext) throws ManifoldCFException
Assert shutdown signal for the current agents daemon.- Throws:
ManifoldCFException
-
clearAgentsShutdownSignal
public static void clearAgentsShutdownSignal(IThreadContext threadContext) throws ManifoldCFException
Clear shutdown signal for the current agents daemon.- Throws:
ManifoldCFException
-
registerAgentsShutdownHook
public void registerAgentsShutdownHook(IThreadContext threadContext) throws ManifoldCFException
Register agents shutdown hook. Call this ONCE before calling startAgents or checkAgents the first time, if you want automatic cleanup of agents on JVM stop.- Throws:
ManifoldCFException
-
runAgents
public void runAgents(IThreadContext threadContext) throws ManifoldCFException
Run agents process. This method will not return until a shutdown signal is sent.- Throws:
ManifoldCFException
-
startAgents
public void startAgents(IThreadContext threadContext) throws ManifoldCFException
Start agents thread for this agents daemon object.- Throws:
ManifoldCFException
-
stopAgents
public void stopAgents(IThreadContext threadContext) throws ManifoldCFException
Stop all started agents running under this agents daemon.- Throws:
ManifoldCFException
-
getAgentsClassServiceType
protected static java.lang.String getAgentsClassServiceType(java.lang.String agentClassName)
-
checkAgents
protected void checkAgents(IThreadContext threadContext) throws ManifoldCFException
Start all not-running agents.- Parameters:
threadContext
- is the thread context.- Throws:
ManifoldCFException
-
-