org.rhq.enterprise.agent
Class AgentRestartCounter
java.lang.Object
org.rhq.enterprise.agent.AgentRestartCounter
public class AgentRestartCounter
- extends Object
Provides a count of the number of times the agent has been restarted
and a reason for the last time the agent was restarted. More
technically, this is the count of the number of times the
agent was started during the full lifetime of the agent's JVM.
- Author:
- John Mazzitelli
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AgentRestartCounter
public AgentRestartCounter()
getLastAgentRestartReason
public AgentRestartCounter.AgentRestartReason getLastAgentRestartReason()
- The reason why the agent was last restarted. This is normally
useful when you want to find out if the last time the restart occurred
was because the VM health check thread reset the agent, but it could be
potentially useful if you want to know that a user restarted it
via an operation or the start prompt command.
- Returns:
- reason code
getNumberOfRestarts
public int getNumberOfRestarts()
- Returns the number of times the agent has been restarted since the
beginning of the agent's JVM lifetime. Typically, this value will
be 1 and the
reason will be
AgentRestartCounter.AgentRestartReason.PROCESS_START to indicate the agent
was started at JVM startup time.
This will be 0 if the agent JVM process was created but the agent
itself was never started at process start time.
If this value is larger than 1, the agent was restarted for some
reason, e.g. the VM health check thread deemed the agent at
critically low memory and thus restarted the agent in an attempt
to bring the agent back to normal memory usage.
- Returns:
- restart count
restartedAgent
public void restartedAgent(AgentRestartCounter.AgentRestartReason reason)
- This should be called whenever the agent is restated. This will increment
the internal counter and set the
last reason
to the given reason code.
- Parameters:
reason - the reason why the agent was restarted
Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.