本文整理汇总了Java中com.owera.xaps.dbi.Heartbeat类的典型用法代码示例。如果您正苦于以下问题:Java Heartbeat类的具体用法?Java Heartbeat怎么用?Java Heartbeat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Heartbeat类属于com.owera.xaps.dbi包,在下文中一共展示了Heartbeat类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: runImpl
import com.owera.xaps.dbi.Heartbeat; //导入依赖的package包/类
@Override
public void runImpl() throws Throwable {
Long anHourAgo = System.currentTimeMillis() - 60 * 60000;
logger.info("ActiveDeviceDetectionTask: Will check if some devices scheduled to return before " + new Date(anHourAgo) + " are too late");
Map<String, Long> inactiveUnits = cleanOld(anHourAgo);
logger.info("ActiveDeviceDetectionTask: Have found " + inactiveUnits.size() + " inactive devices");
for (Entry<String, Long> entry : inactiveUnits.entrySet()) {
String unitId = entry.getKey();
Syslog syslog = dbi.getXaps().getSyslog();
SyslogFilter sf = new SyslogFilter();
sf.setCollectorTmsStart(new Date(anHourAgo)); // look for syslog newer than 1 hour
sf.setUnitId(unitId);
boolean active = false;
List<SyslogEntry> entries = syslog.read(sf, dbi.getXaps());
for (SyslogEntry sentry : entries) {
if (sentry.getFacility() < SyslogConstants.FACILITY_SHELL && !sentry.getContent().contains(Heartbeat.MISSING_HEARTBEAT_ID)) {
logger.notice("ActivceDeviceDetection: Found syslog activity for unit " + unitId + " at " + sentry.getCollectorTimestamp() + " : " + sentry.getContent());
active = true;
break;
}
}
if (active) {
SyslogClient.notice(entry.getKey(), "ProvMsg: No provisioning at " + new Date(entry.getValue()) + " (as expected) or since, but device has been active since " + new Date(anHourAgo)
+ ". TR-069 client may have stopped", dbi.getXaps().getSyslog());
logger.notice("ActivceDeviceDetection: Unit " + entry.getKey() + ": No provisioning at " + new Date(entry.getValue()) + " (as expected) or since, but device has been active "
+ new Date(anHourAgo) + ". TR-069 client may have stopped");
} else {
logger.info("ActivceDeviceDetection: Unit " + entry.getKey() + ": No provisioning at " + new Date(entry.getValue()) + " (as expected) or since, but device may be inactive since "
+ new Date(anHourAgo));
}
}
}