synchronized void startPublishingTimer() { if (state.get() == State.Closed) return; lifetimeCounter--; if (lifetimeCounter < 1) { logger.debug("[id={}] lifetime expired.", subscriptionId); setState(State.Closing); } else { long interval = DoubleMath.roundToLong(publishingInterval, RoundingMode.UP); subscriptionManager .getServer() .getScheduledExecutorService() .schedule(this::onPublishingTimer, interval, TimeUnit.MILLISECONDS); } }