org.rhq.enterprise.agent
Class PrimaryServerSwitchoverThread
java.lang.Object
java.lang.Thread
org.rhq.enterprise.agent.PrimaryServerSwitchoverThread
- All Implemented Interfaces:
- Runnable
public class PrimaryServerSwitchoverThread
- extends Thread
This thread's job is to periodically try to get the agent to point back to
its primary server, if it isn't pointing to that server already.
The "primary server" is the server found at the top of the agent's failover list.
If the agent is already talking to this server, or if the agent does not yet have
a failover list, nothing needs to be done.
If the agent is talking to another server, this thread will probe the primary server
and if it can, this thread will switch the agent's sender back to point to the primary.
If the agent is not in sending mode, this thread will not do anything until it is. The agent
will decide what server it should talk to in that case. This thread is only here
to prevent an agent talking to a non-primary server for a long time when the primary
server is available.
- Author:
- John Mazzitelli
|
Method Summary |
void |
checkNow()
Forces this thread to check now and switch to the primary if needed. |
void |
run()
|
void |
setInterval(long interval)
Sets the time (in milliseconds) that this thread sleeps between checks. |
void |
stopChecking()
Call this method when you want to stop this thread, which effectively stops it from
checking that the agent is pointing to its primary server. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
PrimaryServerSwitchoverThread
public PrimaryServerSwitchoverThread(AgentMain agent)
run
public void run()
- Specified by:
run in interface Runnable- Overrides:
run in class Thread
setInterval
public void setInterval(long interval)
- Sets the time (in milliseconds) that this thread sleeps between checks.
- Parameters:
interval - sleep time, in milliseconds (must not be less than 1000)
stopChecking
public void stopChecking()
- Call this method when you want to stop this thread, which effectively stops it from
checking that the agent is pointing to its primary server.
checkNow
public void checkNow()
- Forces this thread to check now and switch to the primary if needed. If the thread
is already checking, this method does nothing. Effectively, this method wakes up
this thread if its sleeping during the
sleep interval.
Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.