@ Override public synchronized boolean setSafeMode ( boolean safeMode ) { /** * If we are switching off the safe mode, so we need to reset the last * heartbeat timestamp for each of the sessions and nodes. */ if ( safeMode == false ) { LOG . info ( "Resetting the heartbeat times for all sessions" ) ; sessionManager . resetSessionsLastHeartbeatTime ( ) ; LOG . info ( "Resetting the heartbeat times for all nodes" ) ; nodeManager . resetNodesLastHeartbeatTime ( ) ; /** * If we are setting the safe mode to false, we should first set it * in-memory, before we set it at the CPJT. */ this . safeMode = false ; } try { ClusterManagerAvailabilityChecker . getPJTClient ( conf ) . setClusterManagerSafeModeFlag ( safeMode ) ; } catch ( IOException e ) { LOG . info ( "Exception while setting the safe mode flag in ProxyJobTracker: " + e . getMessage ( ) ) ; return false ; } catch ( TException e ) { LOG . info ( "Exception while setting the safe mode flag in ProxyJobTracker: " + e . getMessage ( ) ) ; return false ; } this . safeMode = safeMode ; LOG . info ( "Flag successfully set in ProxyJobTracker" ) ; LOG . info ( "Safe mode is now: " + ( this . safeMode ? "ON" : "OFF" ) ) ; return true ; }
Sets the Safe Mode flag on the Cluster Manager and on the ProxyJobTracker . If we fail to set the flag on the ProxyJobTracker return false which signals that setting the flag on the ProxyJobTracker failed . In that case we should run coronaadmin with the - forceSetSafeModeOnPJT or - forceUnsetSafeModeOnPJT options .