sodonnel opened a new pull request #690: HDDS-3221. Refactor SafeModeHandler to 
use a Notification Interface
URL: https://github.com/apache/hadoop-ozone/pull/690
 
 
   ## What changes were proposed in this pull request?
   
   The SafeModeHandler currently accepts several objects which it notifies when 
the safe mode status changes.
   
   Each of these object are notified using a different method (there is no 
"notification interface") and some of the logic which really belongs in those 
objects (ie what to do when safemode goes on or off) is in the safemode classes 
rather than in the receiving class.
   
   As we may need to extend safemode somewhat to delay pipeline creation until 
sufficient nodes have registered, I think it is worthwhile to refactor this 
area to do the following:
   
   1. Introduce a new Interface "SafeModeTransition" which must be implemented 
by any object which wants to listen for safemode starting or ending.
   ```
   public interface SafeModeTransition {
     void handleSafeModeTransition(SCMSafeModeManager.SafeModeStatus status);
   }
   ```
   2. Pass the SafeModeStatus object over this new interface. That way, we can 
extend SafeModeStatus to include more states in the future than just safemode = 
true / false.
   
   3. Change the constructor of SafeModeHandler to allow any number of objects 
to be registered to make it more flexible going forward.
   
   4. Ensure the logic of what action to take on safemode transition lives 
within the notified objects rather than in the Safemode clases.
   
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-3221
   
   ## How was this patch tested?
   
   Depends on existing unit tests
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to