@Test public void testRefresh() throws Exception { property.set(toJson(FALLBACK_BUDGET_1)); ArchaiusEffectiveJobDisruptionBudgetResolver resolver = new ArchaiusEffectiveJobDisruptionBudgetResolver(repository, sanitizer); assertThat(resolver.resolve(JOB_SELF_MANAGED)).isEqualTo(FALLBACK_BUDGET_1); property.set(toJson(FALLBACK_BUDGET_2)); assertThat(resolver.resolve(JOB_SELF_MANAGED)).isEqualTo(FALLBACK_BUDGET_2); }
private DisruptionBudget refresh() { Property<String> property = repository.get(PROPERTY_KEY, String.class); if (property == null || StringExt.isEmpty(property.get())) { return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } try { return parse(property.get()); } catch (Exception e) { logger.warn("invalid SelfManaged fallback disruption budget configuration ({})", e.getMessage()); return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } }
ArchaiusEffectiveJobDisruptionBudgetResolver implements EffectiveJobDisruptionBudgetResolver { private DisruptionBudget refresh() { Property<String> property = repository.get(PROPERTY_KEY, String.class); if (property == null || StringExt.isEmpty(property.get())) { return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } try { return parse(property.get()); } catch (Exception e) { logger.warn("invalid SelfManaged fallback disruption budget configuration ({})", e.getMessage()); return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } } }
ArchaiusEffectiveJobDisruptionBudgetResolver implements EffectiveJobDisruptionBudgetResolver { private DisruptionBudget refresh() { Property<String> property = repository.get(PROPERTY_KEY, String.class); if (property == null || StringExt.isEmpty(property.get())) { return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } try { return parse(property.get()); } catch (Exception e) { logger.warn("invalid SelfManaged fallback disruption budget configuration ({})", e.getMessage()); return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } } @Inject  ArchaiusEffectiveJobDisruptionBudgetResolver(PropertyRepository repository,
                                                        @Named(JOB_STRICT_SANITIZER) EntitySanitizer sanitizer); }
ArchaiusEffectiveJobDisruptionBudgetResolver implements EffectiveJobDisruptionBudgetResolver { private DisruptionBudget refresh() { Property<String> property = repository.get(PROPERTY_KEY, String.class); if (property == null || StringExt.isEmpty(property.get())) { return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } try { return parse(property.get()); } catch (Exception e) { logger.warn("invalid SelfManaged fallback disruption budget configuration ({})", e.getMessage()); return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } } @Inject  ArchaiusEffectiveJobDisruptionBudgetResolver(PropertyRepository repository,
                                                        @Named(JOB_STRICT_SANITIZER) EntitySanitizer sanitizer); @PreDestroy void shutdown(); @Override DisruptionBudget resolve(Job<?> job); }
ArchaiusEffectiveJobDisruptionBudgetResolver implements EffectiveJobDisruptionBudgetResolver { private DisruptionBudget refresh() { Property<String> property = repository.get(PROPERTY_KEY, String.class); if (property == null || StringExt.isEmpty(property.get())) { return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } try { return parse(property.get()); } catch (Exception e) { logger.warn("invalid SelfManaged fallback disruption budget configuration ({})", e.getMessage()); return DEFAULT_SELF_MANAGED_FALLBACK_JOB_DISRUPTION_BUDGET; } } @Inject  ArchaiusEffectiveJobDisruptionBudgetResolver(PropertyRepository repository,
                                                        @Named(JOB_STRICT_SANITIZER) EntitySanitizer sanitizer); @PreDestroy void shutdown(); @Override DisruptionBudget resolve(Job<?> job); static final String PROPERTY_KEY; }