Stephen O'Donnell created HDDS-3221:
---------------------------------------

             Summary: Refactor SafeModeHandler to use a Notification Interface
                 Key: HDDS-3221
                 URL: https://issues.apache.org/jira/browse/HDDS-3221
             Project: Hadoop Distributed Data Store
          Issue Type: Improvement
    Affects Versions: 0.6.0
            Reporter: Stephen O'Donnell
            Assignee: Stephen O'Donnell


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.

{code}
public interface SafeModeTransition {
  void handleSafeModeTransition(SCMSafeModeManager.SafeModeStatus status);
}
{code}

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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to