@Override public void onEvent(SensorEvent<Object> event) { Function<String, String> postProcessor = getConfig(URL_POST_PROCESSING); String val = event.getValue().toString(); String newVal = (postProcessor != null) ? postProcessor.apply(val) : val; if (AtomicReferences.setIfDifferent(url, newVal)) { log.debug(""+this+" updated on "+event+", "+"enabled="+computeEnablement()); updateEnablement(); } } });
@Override public void onEvent(SensorEvent<Boolean> event) { if (AtomicReferences.setIfDifferent(serviceUp, Boxing.unboxSafely(event.getValue(), false))) { log.debug(""+this+" updated on "+event+", "+"enabled="+computeEnablement()); updateEnablement(); } } });
AtomicReferences.setIfDifferent(serviceUp, currentVal); Function<String, String> postProcessor = getConfig(URL_POST_PROCESSING); String newVal = (postProcessor != null) ? postProcessor.apply(currentVal.toString()) : currentVal.toString(); if (AtomicReferences.setIfDifferent(url, newVal)) { log.debug("{} updated url on initial connectionon, to {}", this, newVal);