org.apache.commons.lang.time.DateUtils#MILLIS_PER_DAY源码实例Demo

下面列出了org.apache.commons.lang.time.DateUtils#MILLIS_PER_DAY 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: datawave   文件: ShardedTableMapFile.java
public static void validateShardIdLocations(Configuration conf, String tableName, int daysToVerify, Map<Text,String> shardIdToLocation) {
    ShardIdFactory shardIdFactory = new ShardIdFactory(conf);
    // assume true unless proven otherwise
    boolean isValid = true;
    int maxShardsPerTserver = conf.getInt(MAX_SHARDS_PER_TSERVER, 1);
    
    for (int daysAgo = 0; daysAgo <= daysToVerify; daysAgo++) {
        long inMillis = System.currentTimeMillis() - (daysAgo * DateUtils.MILLIS_PER_DAY);
        String datePrefix = DateHelper.format(inMillis);
        int expectedNumberOfShards = shardIdFactory.getNumShards(datePrefix);
        boolean shardsExist = shardsExistForDate(shardIdToLocation, datePrefix, expectedNumberOfShards);
        if (!shardsExist) {
            log.error("Shards for " + datePrefix + " for table " + tableName + " do not exist!");
            isValid = false;
            continue;
        }
        boolean shardsAreBalanced = shardsAreBalanced(shardIdToLocation, datePrefix, maxShardsPerTserver);
        if (!shardsAreBalanced) {
            log.error("Shards for " + datePrefix + " for table " + tableName + " are not balanced!");
            isValid = false;
        }
    }
    if (!isValid) {
        throw new IllegalStateException("Shard validation failed for " + tableName + ". Please ensure that "
                        + "shards have been generated. Check log for details about the dates in question");
    }
}
 
源代码2 项目: Eagle   文件: RunningJobCrawlerImpl.java
public void startzkCleanupThread() {
	LOG.info("zk cleanup thread started");
	while(true) {
		try {
			long thresholdTime = System.currentTimeMillis() - controlConfig.zkCleanupTimeInday * DateUtils.MILLIS_PER_DAY; 
			String date = DateTimeUtil.format(thresholdTime, "yyyyMMdd");
			zkStateManager.truncateJobBefore(ResourceType.JOB_CONFIGURATION, date);
			zkStateManager.truncateJobBefore(ResourceType.JOB_COMPLETE_INFO, date);
			Thread.sleep(30 * 60 * 1000);
		}
		catch (Throwable t) {
			LOG.warn("Got an throwable, t: ", t);
		}
	}
}
 
源代码3 项目: Eagle   文件: DefaultDeduplicator.java
public void clearOldCache() {
	List<EntityTagsUniq> removedkeys = new ArrayList<EntityTagsUniq>();
	for (Entry<EntityTagsUniq, Long> entry : entites.entrySet()) {
		EntityTagsUniq entity = entry.getKey();
		if (System.currentTimeMillis() - 7 * DateUtils.MILLIS_PER_DAY > entity.createdTime) {
			removedkeys.add(entry.getKey());
		}
	}
	for (EntityTagsUniq alertKey : removedkeys) {
		entites.remove(alertKey);
	}
}
 
源代码4 项目: eagle   文件: DedupCache.java
public Map<EventUniq, ConcurrentLinkedDeque<DedupValue>> getEvents() {
    if (lastUpdated < 0
        || System.currentTimeMillis() - lastUpdated > CACHE_MAX_EXPIRE_TIME_IN_DAYS * DateUtils.MILLIS_PER_DAY
        || events.size() <= 0) {
        lastUpdated = System.currentTimeMillis();
    }
    return events;
}