clebertsuconic commented on code in PR #5715: URL: https://github.com/apache/activemq-artemis/pull/5715#discussion_r2114258037
########## artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTStateManager.java: ########## @@ -172,25 +175,13 @@ public String toString() { return "MQTTSessionStateManager@" + Integer.toHexString(System.identityHashCode(this)); } - public void storeSessionState(MQTTSessionState state) throws Exception { - logger.debug("Adding durable MQTT state record for: {}", state.getClientId()); - - /* - * It is imperative to ensure the routed message is actually *all the way* on the queue before proceeding - * otherwise there can be a race with removing it. - */ - CountDownLatch latch = new CountDownLatch(1); - Transaction tx = new TransactionImpl(server.getStorageManager()); - server.getPostOffice().route(serializeState(state, server.getStorageManager().generateID()), tx, false); - tx.addOperation(new TransactionOperationAbstract() { - @Override - public void afterCommit(Transaction tx) { - latch.countDown(); - } - }); - tx.commit(); - if (!latch.await(timeout, TimeUnit.MILLISECONDS)) { - throw MQTTBundle.BUNDLE.unableToStoreMqttState(timeout); + public void storeDurableSubscriptionState(MQTTSessionState state) throws Exception { + if (subscriptionPersistenceEnabled) { Review Comment: I would do this through configuration.isSubscriptionPersistenceEnabled() directly... doing that way you would be able to repopulate the variable while the broker is running, and this value would take place without require a reboot. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact