private void applyDefaultSettings(final ProcessorNode processorNode) { try { final Class<?> procClass = processorNode.getProcessor().getClass(); final DefaultSettings ds = procClass.getAnnotation(DefaultSettings.class); if (ds != null) { processorNode.setYieldPeriod(ds.yieldDuration()); processorNode.setPenalizationPeriod(ds.penaltyDuration()); processorNode.setBulletinLevel(ds.bulletinLevel()); } } catch (final Exception ex) { logger.error("Error while setting default settings from DefaultSettings annotation: {}", ex.toString(), ex); } }
@DefaultSettings(yieldDuration = "100 ms") // decrease the default yield since we are triggering when empty public abstract class AbstractFetchHDFSRecord extends AbstractHadoopProcessor {
"from the previous iteration, and calculate the current metrics to be sent on next iteration. Scheduling this reporting " + "task at a frequency other than 60 seconds may produce unexpected results.") @DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min") public class AmbariReportingTask extends AbstractReportingTask {
DefaultSchedule dsc = processorDetails.getProcClass().getAnnotation(DefaultSchedule.class); try { this.setSchedulingStrategy(dsc.strategy()); } catch (Throwable ex) { LOG.error(String.format("Error while setting scheduling strategy from DefaultSchedule annotation: %s", ex.getMessage()), ex); this.setScheduldingPeriod(dsc.period()); } catch (Throwable ex) { this.setSchedulingStrategy(SchedulingStrategy.TIMER_DRIVEN); setMaxConcurrentTasks(dsc.concurrentTasks()); } catch (Throwable ex) { LOG.error(String.format("Error while setting max concurrent tasks from DefaultSchedule annotation: %s", ex.getMessage()), ex);
public AbstractReportingTaskNode(final LoggableComponent<ReportingTask> reportingTask, final String id, final ControllerServiceProvider controllerServiceProvider, final ProcessScheduler processScheduler, final ValidationContextFactory validationContextFactory, final String componentType, final String componentCanonicalClass, final ComponentVariableRegistry variableRegistry, final ReloadComponent reloadComponent, final ExtensionManager extensionManager, final ValidationTrigger validationTrigger, final boolean isExtensionMissing) { super(id, validationContextFactory, controllerServiceProvider, componentType, componentCanonicalClass, variableRegistry, reloadComponent, extensionManager, validationTrigger, isExtensionMissing); this.reportingTaskRef = new AtomicReference<>(new ReportingTaskDetails(reportingTask)); this.processScheduler = processScheduler; this.serviceLookup = controllerServiceProvider; final Class<?> reportingClass = reportingTask.getComponent().getClass(); DefaultSchedule dsc = AnnotationUtils.findAnnotation(reportingClass, DefaultSchedule.class); if(dsc != null) { try { this.setSchedulingStrategy(dsc.strategy()); } catch (Throwable ex) { LOG.error(String.format("Error while setting scheduling strategy from DefaultSchedule annotation: %s", ex.getMessage()), ex); } try { this.setSchedulingPeriod(dsc.period()); } catch (Throwable ex) { this.setSchedulingStrategy(SchedulingStrategy.TIMER_DRIVEN); LOG.error(String.format("Error while setting scheduling period from DefaultSchedule annotation: %s", ex.getMessage()), ex); } } }
@DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min") public class SiteToSiteBulletinReportingTask extends AbstractSiteToSiteReportingTask {
@DefaultSettings(yieldDuration = "100 ms") // decrease the default yield since we are triggering when empty public abstract class AbstractPutHDFSRecord extends AbstractHadoopProcessor {
"from the previous iteration, and calculate the current metrics to be sent on next iteration. Scheduling this reporting " + "task at a frequency other than 60 seconds may produce unexpected results.") @DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min") public class AmbariReportingTask extends AbstractReportingTask {
@DefaultSchedule(strategy = SchedulingStrategy.TIMER_DRIVEN, period = "1 min") public class SiteToSiteBulletinReportingTask extends AbstractSiteToSiteReportingTask {