@ SuppressWarnings ( "unchecked" ) public static void executeCommand ( String [ ] args ) throws IOException { OptionParser parser = getParser ( ) ; // declare parameters String url = null ; List < Integer > nodeIds = null ; Boolean allNodes = true ; Boolean confirm = false ; // parse command-line input OptionSet options = parser . parse ( args ) ; if ( options . has ( AdminParserUtils . OPT_HELP ) ) { printHelp ( System . out ) ; return ; } // check required options and/or conflicting options AdminParserUtils . checkRequired ( options , AdminParserUtils . OPT_URL ) ; AdminParserUtils . checkOptional ( options , AdminParserUtils . OPT_NODE , AdminParserUtils . OPT_ALL_NODES ) ; // load parameters url = ( String ) options . valueOf ( AdminParserUtils . OPT_URL ) ; if ( options . has ( AdminParserUtils . OPT_NODE ) ) { nodeIds = ( List < Integer > ) options . valuesOf ( AdminParserUtils . OPT_NODE ) ; allNodes = false ; } if ( options . has ( AdminParserUtils . OPT_CONFIRM ) ) { confirm = true ; } // print summary System . out . println ( "Remove metadata related to rebalancing" ) ; System . out . println ( "Location:" ) ; System . out . println ( " bootstrap url = " + url ) ; if ( allNodes ) { System . out . println ( " node = all nodes" ) ; } else { System . out . println ( " node = " + Joiner . on ( ", " ) . join ( nodeIds ) ) ; } // execute command if ( ! AdminToolUtils . askConfirm ( confirm , "remove metadata related to rebalancing" ) ) { return ; } AdminClient adminClient = AdminToolUtils . getAdminClient ( url ) ; if ( allNodes ) { nodeIds = AdminToolUtils . getAllNodeIds ( adminClient ) ; } AdminToolUtils . assertServerNotInRebalancingState ( adminClient , nodeIds ) ; doMetaClearRebalance ( adminClient , nodeIds ) ; }
Parses command - line and removes metadata related to rebalancing .