{
if (fragmentId == SysProcFragmentId.PF_shutdownSync) {
VoltDB.instance().getHostMessenger().prepareForShutdown();
if (!m_failsafeArmed.getAndSet(true)) {
m_failsafe.start();
new VoltLogger("HOST").warn("VoltDB shutdown operation requested and in progress. Cluster will terminate shortly.");
}
return new DependencyPair(DEP_shutdownSync,
new VoltTable(new ColumnInfo[] { new ColumnInfo("HA", VoltType.STRING) } ));
}
else if (fragmentId == SysProcFragmentId.PF_shutdownSyncDone) {
return new DependencyPair(DEP_shutdownSyncDone,
new VoltTable(new ColumnInfo[] { new ColumnInfo("HA", VoltType.STRING) } ));
}
else if (fragmentId == SysProcFragmentId.PF_shutdownCommand) {
Thread shutdownThread = new Thread() {
@Override
public void run() {
boolean die = false;
try {
die = VoltDB.instance().shutdown(this);
} catch (InterruptedException e) {
new VoltLogger("HOST").error(
"Exception while attempting to shutdown VoltDB from shutdown sysproc",
e);
}
if (die) {
new VoltLogger("HOST").warn("VoltDB shutting down as requested by @Shutdown command.");
System.exit(0);
}
else {
try {
Thread.sleep(10000);