|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectariba.util.shutdown.ShutdownManager
public class ShutdownManager
The ShutdownManager is responsible for executing shutdown requests as graceful as possible. There are several elements in the shutdown sequence:
Nested Class Summary | |
---|---|
static interface |
ShutdownManager.ShutdownNotifier
This is an interface defined to allow the shutdown manager to callback a notifier just before the actual shutdown. |
Field Summary | |
---|---|
static java.lang.String |
AutoRecycleKey
|
static java.lang.String |
DirectActionKey
|
static int |
FatalExitNoRestart
Exit code to use on fatal failure without restart. |
static int |
FatalExitRestart
Exit code to use on fatal failure with restart. |
static java.lang.String |
FinalShutdownNoticeTopic
|
static java.lang.String |
NodeKey
|
static java.lang.String[] |
NodeStatusStrings
|
static java.lang.String |
NodeStatusUnknown
|
static int |
NormalExitNoRestart
Exit code to use on normal exit with no restart |
static java.lang.String |
SignalKey
|
static int |
StatusNodeAutoRecycle
Node is in Auto Recycle shutdown. |
static int |
StatusNodeDirectAction
Node is in shutdown initiated by a Direct Action. |
static int |
StatusNodeImmediate
Node is in immediate (synchronous, forced) shutdown. |
static int |
StatusNodeRunning
Nodes is in normal running state. |
static int |
StatusNodeSignal
Node is in shutdown initiated by a signal. |
static int |
StatusSystemRollingRestart
System is in Rolling Restart. |
static int |
StatusSystemRollingUpgrade
System is in Rolling Upgrade. |
static int |
StatusSystemRunning
System is in normal running state. |
static java.lang.String[] |
SystemStatusStrings
|
static java.lang.String |
SystemStatusUnknown
|
Method Summary | |
---|---|
static void |
addLastShutdownHook(java.lang.Thread hook)
Adds a ShutdownHook to be invoked before the exit |
static void |
addShutdownDelayer(ShutdownDelayer delayer)
Adds a ShutdownDelayer to be invoked during the asynhchronous shutdown |
static void |
addShutdownHook(java.lang.Thread hook)
Adds a ShutdownHook to be invoked before the exit |
static void |
forceShutdown(int exitCode)
Triggers the synchronous and immediate shutdown sequence |
static ShutdownManager |
get()
Returns the instance of the ShutdownManager |
long |
getGracePeriod()
Returns the milliseconds for which we wait for all the ShutdownDelayers to complete. |
static int |
getMetastableSystemStatus(int minuteWindow,
int samples)
Get a meta-stable value of the Shutdown Manager's state. |
static int |
getNodeStatus()
|
int |
getNodeStatus(java.lang.String type)
Returns the status code given a shutdown type. |
static java.lang.String |
getNodeStatusAsString(int status)
|
RecycleManager |
getRecycleMgr()
|
static long |
getShutdownStartTime()
|
static int |
getSystemStatus()
Determine the current system shutdown (cluster) status. |
static java.lang.String |
getSystemStatusAsString(int status)
|
ThreadFactory |
getThreadFactory()
|
long |
getTimeBeforeShutdown()
Returns the number of milliseconds before we will force the shutdown (unless all ShutdownDelayer let the shutdown proceed). |
long |
getWarningInterval()
Returns the millisecond interval between warnings during the warning perdiod. |
long |
getWarningPeriod()
Returns the millisecond period during which issue shutdown warnings through the UI. |
void |
registerShutdownManagerProcessor(ShutdownManagerProcessorIfc smp)
|
void |
registerSignalHandlerForAsynchronousShutdown(java.lang.String signal)
Creates and registers a SignalHandler for the given signal
name which will trigger the execution of the asynchronous shutdown |
void |
registerSignalHandlerForSynchronousShutdown(java.lang.String signal)
Creates and registers a SignalHandler for the given signal
name which will trigger the execution of the asynchronous shutdown |
static void |
restartAfterStartupError()
Shutdowns a node so that it can restarted after a transient startup error. |
void |
rollingRestartBegin()
Record start of Rolling Restart. |
void |
rollingRestartEnd()
Record end of Rolling Restart. |
void |
rollingUpgradeBegin()
Record start of Rolling Upgrade. |
void |
rollingUpgradeEnd()
Record end of Rolling Upgrade. |
static void |
setExitHook(ExitHook hook)
Changes the ExitHook |
void |
setHookRunnerTimeout(int timeout)
Defines the delay for which we wait for all the ShutdownHooks to complete. |
void |
setPingInterval(int interval)
Defines the interval between queries to the ShutdownDelayer |
void |
setPrintExtraMessages(boolean value)
Specifies whether to print extra messages during the shutdown. |
void |
setShutdownNotifier(ShutdownManager.ShutdownNotifier notifier)
Set the shutdownNotifier. |
void |
setShutdownTimes(java.lang.String type,
int gracePeriod,
int warningPeriod,
int warningInterval)
Sets a group of shutdown times for a given key. |
static void |
setSystemStatus(int status)
|
void |
setThreadFactory(ThreadFactory tf)
Sets the ThreadFactory that will be used for creating new threads as needed during the shutdown sequence |
static void |
shutdown(int exitCode,
java.lang.String type)
Triggers the start of the asynchronous shutdown sequence. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NormalExitNoRestart
public static final int FatalExitRestart
public static final int FatalExitNoRestart
public static final int StatusSystemRunning
public static final int StatusSystemRollingUpgrade
public static final int StatusSystemRollingRestart
public static final java.lang.String SystemStatusUnknown
public static final java.lang.String[] SystemStatusStrings
public static final int StatusNodeRunning
public static final int StatusNodeImmediate
public static final int StatusNodeDirectAction
public static final int StatusNodeSignal
public static final int StatusNodeAutoRecycle
public static final java.lang.String NodeStatusUnknown
public static final java.lang.String[] NodeStatusStrings
public static final java.lang.String DirectActionKey
public static final java.lang.String SignalKey
public static final java.lang.String AutoRecycleKey
public static final java.lang.String FinalShutdownNoticeTopic
public static final java.lang.String NodeKey
Method Detail |
---|
public static ShutdownManager get()
public RecycleManager getRecycleMgr()
public static void addShutdownDelayer(ShutdownDelayer delayer)
delayer
- the ShutdownDelayer to be addedpublic static void addShutdownHook(java.lang.Thread hook)
hook
- the ShutdownHook to be addedpublic static void addLastShutdownHook(java.lang.Thread hook)
hook
- the ShutdownHook to be addedpublic static void setExitHook(ExitHook hook)
hook
- the new ExitHook to usepublic static void shutdown(int exitCode, java.lang.String type)
exitCode
- the exit code to return at the endpublic static void forceShutdown(int exitCode)
exitCode
- the exit code to returnpublic static void restartAfterStartupError()
public void setHookRunnerTimeout(int timeout)
timeout
- delay in minutespublic void setShutdownTimes(java.lang.String type, int gracePeriod, int warningPeriod, int warningInterval)
type
- shutdown typegracePeriod
- overall delay period in minuteswarningPeriod
- total period to issue warnings in UI in minuteswarningInterval
- interval between UI warningspublic int getNodeStatus(java.lang.String type)
public void rollingUpgradeBegin()
public void rollingUpgradeEnd()
public void rollingRestartBegin()
public void rollingRestartEnd()
public long getGracePeriod()
public long getWarningPeriod()
public long getWarningInterval()
getWarningPeriod()
public void setPingInterval(int interval)
interval
- delay in secondspublic void setThreadFactory(ThreadFactory tf)
tf
- the new ThreadFactorypublic ThreadFactory getThreadFactory()
public void setPrintExtraMessages(boolean value)
true
is passed to that
method
value
- if true
the extra messages will be printed
on the consolepublic void registerSignalHandlerForAsynchronousShutdown(java.lang.String signal)
SignalHandler
for the given signal
name which will trigger the execution of the asynchronous shutdown
signal
- name of the signal to register withpublic void registerSignalHandlerForSynchronousShutdown(java.lang.String signal)
SignalHandler
for the given signal
name which will trigger the execution of the asynchronous shutdown
signal
- name of the signal to register withpublic void registerShutdownManagerProcessor(ShutdownManagerProcessorIfc smp)
public long getTimeBeforeShutdown()
public void setShutdownNotifier(ShutdownManager.ShutdownNotifier notifier)
public static int getSystemStatus()
getMetastableSystemStatus(int, int)
instead to allow
for a delayed response.
public static int getMetastableSystemStatus(int minuteWindow, int samples)
StatusSystemRunning
) while all the nodes get to the correct stable
state, wait up to the specified number of minutes before returning the shutdown
state of the cluster.
Subsequent calls only wait additional time if the largest prior window, plus any
time elapsed since then, is not long enough to cover the new window.
If two distinct invocations have differing minute windows, both window requests
will be effectively honored.
minuteWindow
- maximum number of minutes to wait before considering the system
stable; values below 1
treated as 1
;
values over 60
treated as 60
(i.e., maximum delay to obtain a
stable sample is an hour)samples
- number of times to sample the shutdown state during window;
values below 2
treated as 2
values over (the limited value of) 2*minuteWindow treated as that value
(i.e., the maximum sample rate is twice per minute)
public static java.lang.String getSystemStatusAsString(int status)
public static void setSystemStatus(int status)
public static int getNodeStatus()
public static java.lang.String getNodeStatusAsString(int status)
public static long getShutdownStartTime()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |