private int setSafeMode ( boolean safeMode ) throws IOException { // Get the current configuration CoronaConf conf = new CoronaConf ( getConf ( ) ) ; InetSocketAddress address = NetUtils . createSocketAddr ( conf . getClusterManagerAddress ( ) ) ; TFramedTransport transport = new TFramedTransport ( new TSocket ( address . getHostName ( ) , address . getPort ( ) ) ) ; ClusterManagerService . Client client = new ClusterManagerService . Client ( new TBinaryProtocol ( transport ) ) ; try { transport . open ( ) ; if ( client . setSafeMode ( safeMode ) ) { System . out . println ( "The safeMode is: " + ( safeMode ? "ON" : "OFF" ) ) ; } else { System . err . println ( "Could not set the safeMode flag" ) ; } } catch ( TException e ) { throw new IOException ( e ) ; } return 0 ; }
Turns on the Safe Mode if safeMode is true . Turns off the Safe Mode if safeMode is false .