@Override public void onEvent(SensorEvent<Object> event) { if (firstUpTime == null) { if (event != null && Attributes.SERVICE_UP.equals(event.getSensor()) && Boolean.TRUE.equals(event.getValue())) { firstUpTime = event.getTimestamp(); } else if (event == null && Boolean.TRUE.equals(entity.getAttribute(Attributes.SERVICE_UP))) { // If this enricher is registered after the entity is up, then we'll get a "synthetic" // onEvent(null) firstUpTime = System.currentTimeMillis(); } } super.onEvent(event); }