当前位置: 首页>>代码示例>>Java>>正文


Java Heartbeat类代码示例

本文整理汇总了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));
		}
	}
}
 
开发者ID:freeacs,项目名称:tr069,代码行数:33,代码来源:ActiveDeviceDetectionTask.java


注:本文中的com.owera.xaps.dbi.Heartbeat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。