Java Code Examples for org.apache.commons.lang.time.DateUtils#MILLIS_PER_DAY
The following examples show how to use
org.apache.commons.lang.time.DateUtils#MILLIS_PER_DAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ShardedTableMapFile.java From datawave with Apache License 2.0 | 5 votes |
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"); } }
Example 2
Source File: RunningJobCrawlerImpl.java From Eagle with Apache License 2.0 | 5 votes |
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); } } }
Example 3
Source File: DefaultDeduplicator.java From Eagle with Apache License 2.0 | 5 votes |
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); } }
Example 4
Source File: DedupCache.java From eagle with Apache License 2.0 | 5 votes |
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; }