Java Code Examples for org.apache.commons.lang.time.DateUtils#MILLIS_PER_MINUTE

The following examples show how to use org.apache.commons.lang.time.DateUtils#MILLIS_PER_MINUTE . 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: KafkaMessageDistributionBolt.java    From eagle with Apache License 2.0 6 votes vote down vote up
@Override
public void prepare(Map stormConf, TopologyContext context, OutputCollector collector) {
    String site = config.getString("dataSourceConfig.site");
    String topic = config.getString("dataSourceConfig.topic");
    this.baseMetricDimension = new HashMap<>();
    this.baseMetricDimension.put("site", site);
    this.baseMetricDimension.put("topic", topic);
    registry = new MetricRegistry();

    this.granularity = DEFAULT_METRIC_GRANULARITY;
    if (config.hasPath("dataSourceConfig.kafkaDistributionDataIntervalMin")) {
        this.granularity = config.getInt("dataSourceConfig.kafkaDistributionDataIntervalMin") * DateUtils.MILLIS_PER_MINUTE;
    }

    String host = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.HOST);
    int port = config.getInt(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PORT);
    String username = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.USERNAME);
    String password = config.getString(EagleConfigConstants.EAGLE_PROPS + "." + EagleConfigConstants.EAGLE_SERVICE + "." + EagleConfigConstants.PASSWORD);
    listener = new EagleServiceReporterMetricListener(host, port, username, password);
}
 
Example 2
Source File: RunningJobCrawlerImpl.java    From Eagle with Apache License 2.0 5 votes vote down vote up
public void startCompleteStatusCheckerThread() {
	while(true) {
		List<Object> list;
		try {
			list = fetcher.getResource(ResourceType.JOB_LIST, JobState.COMPLETED.name());
			if (list == null) {
				LOG.warn("Current Completed Job List is Empty");
				continue;
			}
			@SuppressWarnings("unchecked")
			List<AppInfo> apps = (List<AppInfo>)list.get(0);
			Set<JobContext> completedJobSet = new HashSet<JobContext>();
			for (AppInfo app : apps) {
				//Only fetch MapReduce job
				if (!YarnApplicationType.MAPREDUCE.name().equals(app.getApplicationType()) 
				|| !jobFilter.accept(app.getUser())) {
					continue;
				}
				if (System.currentTimeMillis() - app.getFinishedTime() < controlConfig.completedJobOutofDateTimeInMin * DateUtils.MILLIS_PER_MINUTE) {
					completedJobSet.add(new JobContext(JobUtils.getJobIDByAppID(app.getId()),app.getUser(), System.currentTimeMillis()));
				}
			}
			
			if (controlConfig.jobConfigEnabled) {
				addIntoProcessingQueueAndList(completedJobSet, queueOfConfig, ResourceType.JOB_CONFIGURATION);
			}

			if (controlConfig.jobInfoEnabled) {
				addIntoProcessingQueueAndList(completedJobSet, queueOfCompleteJobInfo, ResourceType.JOB_COMPLETE_INFO);
			}
			Thread.sleep(20 * 1000);
		} catch (Throwable t) {
			LOG.error("Got a throwable in fetching job completed list :", t);
		}						
	}
}
 
Example 3
Source File: DefaultDeduplicator.java    From Eagle with Apache License 2.0 5 votes vote down vote up
public AlertDeduplicationStatus checkDedup(EntityTagsUniq key){
	long current = key.timestamp;
	if(!entites.containsKey(key)){
		entites.put(key, current);
		return AlertDeduplicationStatus.NEW;
	}
	
	long last = entites.get(key);
	if(current - last >= dedupIntervalMin * DateUtils.MILLIS_PER_MINUTE){
		entites.put(key, current);
		return AlertDeduplicationStatus.DUPLICATED;
	}
	
	return AlertDeduplicationStatus.IGNORED;
}
 
Example 4
Source File: EagleMetric.java    From eagle with Apache License 2.0 4 votes vote down vote up
public EagleMetric(long latestUserTimeClock, String metricName, double value) {
    this(latestUserTimeClock, metricName, value, 5 * DateUtils.MILLIS_PER_MINUTE);
}