sijie commented on a change in pull request #873: Issue280: Add StateManager to 
manage Bookie's state, and use it to turn bookie into readonly when 
sortedLedgerStorage failed to flush data
URL: https://github.com/apache/bookkeeper/pull/873#discussion_r158769957
 
 

 ##########
 File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
 ##########
 @@ -734,21 +719,11 @@ public Number getDefaultValue() {
 
             @Override
             public Number getSample() {
-                if (!rmRegistered.get()){
-                    return -1;
-                } else if (forceReadOnly.get() || 
bookieStatus.isInReadOnlyMode()) {
-                    return 0;
-                } else {
-                    return 1;
-                }
+               return stateManager.getState();
 
 Review comment:
   I would suggest moving this status gauge into bk state manager. it is making 
more sense to have state manager expose the status rather than the bookie. so 
you don't need to have defined `getState` method in this state manager 
interface.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to