// we can ensure that it only shows up on the cores that we want it to.
this.threadManager.initPerioidicThread();
if (debug.val) LOG.debug("init periodic thread");
// Periodic Work Processor
this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() {
@Override
public void runImpl() {
try {
HStoreSite.this.processPeriodicWork();
} catch (Throwable ex) {
ex.printStackTrace();
}
}
}, 0, hstore_conf.site.exec_periodic_interval, TimeUnit.MILLISECONDS);
if (debug.val) LOG.debug("exec periodic interval");
// Heartbeats
this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() {
@Override
public void runImpl() {
try {
if (HStoreSite.this.hstore_coordinator != null) {
HStoreSite.this.hstore_coordinator.sendHeartbeat();
}
} catch (Throwable ex) {
ex.printStackTrace();
}
}
}, hstore_conf.site.network_heartbeats_interval,
hstore_conf.site.network_heartbeats_interval, TimeUnit.MILLISECONDS);
if (debug.val) LOG.debug("heartbeat");
// HStoreStatus
if (hstore_conf.site.status_enable) {
this.threadManager.schedulePeriodicWork(
this.status_monitor,
hstore_conf.site.status_interval,
hstore_conf.site.status_interval,
TimeUnit.MILLISECONDS);
}
if (debug.val) LOG.info("exec status enable");
// AntiCache Memory Monitor
if (debug.val) LOG.debug("about to starting memory monitor thread");
if (this.anticacheManager != null) {
if (debug.val) LOG.debug("acm not null");
if (this.anticacheManager.getEvictableTables().isEmpty() == false) {
if (debug.val) LOG.debug("get evictables true");
this.threadManager.schedulePeriodicWork(
this.anticacheManager.getMemoryMonitorThread(),
hstore_conf.site.anticache_check_interval,
hstore_conf.site.anticache_check_interval,
TimeUnit.MILLISECONDS);
} else {
LOG.warn("There are no tables marked as evictable. Disabling anti-cache monitoring");
}
}
// small stats samples
this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() {
@Override
public void runImpl() {
SystemStatsCollector.asyncSampleSystemNow(false, false);
}
}, 0, 5, TimeUnit.SECONDS);
// medium stats samples
this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() {
@Override
public void runImpl() {
SystemStatsCollector.asyncSampleSystemNow(true, false);
}
}, 0, 1, TimeUnit.MINUTES);
// large stats samples
this.threadManager.schedulePeriodicWork(new ExceptionHandlingRunnable() {
@Override
public void runImpl() {
SystemStatsCollector.asyncSampleSystemNow(true, true);
}
}, 0, 6, TimeUnit.MINUTES);