jbonofre opened a new issue, #2551:
URL: https://github.com/apache/activemq/issues/2551

   ## Problem
   
   When a broker is configured with `startAsync=true` and is running as a slave 
(blocked waiting on the shared/exclusive lock), Jolokia queries against the 
Broker MBean fail with:
   
   ```
   java.lang.IllegalStateException: Broker is not yet started.
   ```
   
   Browsing the same MBean directly in JConsole shows all attributes correctly, 
including `Slave=true`.
   
   ## Root cause
   
   In `BrokerView.java`, most attribute getters are safe to call before the 
`ManagedRegionBroker` object exists — for example `isSlave()` reads directly 
from `BrokerService` and never touches it. However, a few getters — 
`getBrokerId()`, `getBrokerName()`, plus several destination/statistics getters 
— call `safeGetBroker()`, which throws `IllegalStateException("Broker is not 
yet started.")` while the slave is still waiting on the lock.
   
   Since Jolokia reads all attributes on an MBean in a single batch request, 
that one exception aborts the entire response, so attributes that would have 
succeeded independently (such as `Slave`) never come back either.
   
   ## Environment
   
   - `startAsync=true`
   - Broker running as slave, blocked on lock acquisition
   
   ## Suggested fix
   
   Have the read-only getters in `BrokerView` return a safe fallback instead of 
throwing when the `ManagedRegionBroker` isn't set yet:
   - broker name falls back to the configured name on `BrokerService`
   - broker ID returns `null`
   - counts return `0`
   - lists return empty
   
   Getters that actually mutate broker state (add/remove destinations, durable 
subscriptions, stats reset) should keep throwing, since those genuinely can't 
run yet.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to