public void run() { LOG.info("Starting reconfiguration task."); final Configuration oldConf = parent.getConf(); final Configuration newConf = parent.getNewConf(); final Collection<PropertyChange> changes = parent.getChangedProperties(newConf, oldConf); Map<PropertyChange, Optional<String>> results = Maps.newHashMap(); ConfigRedactor oldRedactor = new ConfigRedactor(oldConf); String oldValRedacted = oldRedactor.redact(change.prop, change.oldVal); String newValRedacted = newRedactor.redact(change.prop, change.newVal); if (!parent.isPropertyReconfigurable(change.prop)) { LOG.info(String.format( "Property %s is not configurable: old value: %s, new value: %s", try { String effectiveValue = parent.reconfigurePropertyImpl(change.prop, change.newVal); if (change.newVal != null) { oldConf.set(change.prop, effectiveValue);
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigurePropertyImpl. */ @Override public final void reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); synchronized(getConf()) { getConf().get(property); String effectiveValue = reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, effectiveValue); } else { getConf().unset(property); } } } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
private static void waitAsyncReconfigureTaskFinish(ReconfigurableBase rb) throws InterruptedException { ReconfigurationTaskStatus status = null; int count = 20; while (count > 0) { status = rb.getReconfigurationTaskStatus(); if (status.stopped()) { break; } count--; Thread.sleep(500); } assert(status.stopped()); }
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigureProperty. */ @Override public final void reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); synchronized(getConf()) { getConf().get(property); String effectiveValue = reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, effectiveValue); } else { getConf().unset(property); } } } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
private static void waitAsyncReconfigureTaskFinish(ReconfigurableBase rb) throws InterruptedException { ReconfigurationTaskStatus status = null; int count = 20; while (count > 0) { status = rb.getReconfigurationTaskStatus(); if (status.stopped()) { break; } count--; Thread.sleep(500); } assert(status.stopped()); }
public void run() { LOG.info("Starting reconfiguration task."); Configuration oldConf = this.parent.getConf(); Configuration newConf = new Configuration(); Collection<PropertyChange> changes = this.parent.getChangedProperties(newConf, oldConf); Map<PropertyChange, Optional<String>> results = Maps.newHashMap(); for (PropertyChange change : changes) { String errorMessage = null; if (!this.parent.isPropertyReconfigurable(change.prop)) { errorMessage = "Property " + change.prop + " is not reconfigurable"; + "\"."); try { this.parent.reconfigurePropertyImpl(change.prop, change.newVal); } catch (ReconfigurationException e) { errorMessage = e.getCause().getMessage();
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigureProperty. */ @Override public final String reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); String oldVal; synchronized(getConf()) { oldVal = getConf().get(property); reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, newVal); } else { getConf().unset(property); } } return oldVal; } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }
public void run() { LOG.info("Starting reconfiguration task."); final Configuration oldConf = parent.getConf(); final Configuration newConf = parent.getNewConf(); final Collection<PropertyChange> changes = parent.getChangedProperties(newConf, oldConf); Map<PropertyChange, Optional<String>> results = Maps.newHashMap(); ConfigRedactor oldRedactor = new ConfigRedactor(oldConf); String oldValRedacted = oldRedactor.redact(change.prop, change.oldVal); String newValRedacted = newRedactor.redact(change.prop, change.newVal); if (!parent.isPropertyReconfigurable(change.prop)) { LOG.info(String.format( "Property %s is not configurable: old value: %s, new value: %s", try { String effectiveValue = parent.reconfigurePropertyImpl(change.prop, change.newVal); if (change.newVal != null) { oldConf.set(change.prop, effectiveValue);
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigureProperty. */ @Override public final String reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); String oldVal; synchronized(getConf()) { oldVal = getConf().get(property); reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, newVal); } else { getConf().unset(property); } } return oldVal; } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }
public void run() { LOG.info("Starting reconfiguration task."); Configuration oldConf = this.parent.getConf(); Configuration newConf = new Configuration(); Collection<PropertyChange> changes = this.parent.getChangedProperties(newConf, oldConf); Map<PropertyChange, Optional<String>> results = Maps.newHashMap(); ConfigRedactor oldRedactor = new ConfigRedactor(oldConf); String oldValRedacted = oldRedactor.redact(change.prop, change.oldVal); String newValRedacted = newRedactor.redact(change.prop, change.newVal); if (!this.parent.isPropertyReconfigurable(change.prop)) { errorMessage = "Property " + change.prop + " is not reconfigurable"; + "\"."); try { this.parent.reconfigurePropertyImpl(change.prop, change.newVal); } catch (ReconfigurationException e) { errorMessage = e.getCause().getMessage();
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigureProperty. */ @Override public final String reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); String oldVal; synchronized(getConf()) { oldVal = getConf().get(property); reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, newVal); } else { getConf().unset(property); } } return oldVal; } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }
public void run() { LOG.info("Starting reconfiguration task."); Configuration oldConf = this.parent.getConf(); Configuration newConf = new Configuration(); Collection<PropertyChange> changes = this.parent.getChangedProperties(newConf, oldConf); Map<PropertyChange, Optional<String>> results = Maps.newHashMap(); ConfigRedactor oldRedactor = new ConfigRedactor(oldConf); String oldValRedacted = oldRedactor.redact(change.prop, change.oldVal); String newValRedacted = newRedactor.redact(change.prop, change.newVal); if (!this.parent.isPropertyReconfigurable(change.prop)) { errorMessage = "Property " + change.prop + " is not reconfigurable"; + "\"."); try { this.parent.reconfigurePropertyImpl(change.prop, change.newVal); } catch (ReconfigurationException e) { errorMessage = e.getCause().getMessage();
/** * {@inheritDoc} * * This method makes the change to this objects {@link Configuration} * and calls reconfigurePropertyImpl to update internal data structures. * This method cannot be overridden, subclasses should instead override * reconfigureProperty. */ @Override public final String reconfigureProperty(String property, String newVal) throws ReconfigurationException { if (isPropertyReconfigurable(property)) { LOG.info("changing property " + property + " to " + newVal); String oldVal; synchronized(getConf()) { oldVal = getConf().get(property); reconfigurePropertyImpl(property, newVal); if (newVal != null) { getConf().set(property, newVal); } else { getConf().unset(property); } } return oldVal; } else { throw new ReconfigurationException(property, newVal, getConf().get(property)); } }
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }
/** * {@inheritDoc} * * Subclasses may wish to override this with a more efficient implementation. */ @Override public boolean isPropertyReconfigurable(String property) { return getReconfigurableProperties().contains(property); }