public static void runServer ( Module ... modules ) { Injector injector = Guice . createInjector ( modules ) ; PresentsServer server = injector . getInstance ( PresentsServer . class ) ; try { // initialize the server server . init ( injector ) ; // check to see if we should load and invoke a test module before running the server String testmod = System . getProperty ( "test_module" ) ; if ( testmod != null ) { try { log . info ( "Invoking test module" , "mod" , testmod ) ; Class < ? > tmclass = Class . forName ( testmod ) ; Runnable trun = ( Runnable ) tmclass . newInstance ( ) ; trun . run ( ) ; } catch ( Exception e ) { log . warning ( "Unable to invoke test module '" + testmod + "'." , e ) ; } } // start the server to running (this method call won't return until the server is shut // down) server . run ( ) ; } catch ( Throwable t ) { log . warning ( "Unable to initialize server." , t ) ; System . exit ( - 1 ) ; } }
Inits and runs the PresentsServer bound in the given modules . This blocks until the server is shut down .