public static void main ( String [ ] args ) { log . info ( "Starting." ) ; log . info ( BuildData . revisionString ( ) ) ; log . info ( BuildData . buildString ( ) ) ; try { System . in . close ( ) ; // Release a FD we don't need. } catch ( Exception e ) { log . warn ( "Failed to close stdin" , e ) ; } if ( args . length == 0 ) { log . error ( "No command supplied" ) ; mainUsage ( System . err ) ; System . exit ( - 1 ) ; } // This is not normally needed since values passed on the CL are auto-trimmed, // but since the Main may be called programatically in some embedded scenarios, // let's save us some time and trim the values here. for ( int i = 0 ; i < args . length ; i ++ ) { args [ i ] = args [ i ] . trim ( ) ; } String targetTool = args [ 0 ] . toLowerCase ( ) ; if ( ! COMMANDS . containsKey ( targetTool ) ) { log . error ( "Command not recognized: [" + targetTool + "]" ) ; mainUsage ( System . err ) ; System . exit ( - 1 ) ; } process ( targetTool , shift ( args ) ) ; }
The OpenTSDB fat - jar main entry point