public static MediaTimer createTimer ( ) { MediaTimer timer = null ; for ( String timerClass : PERF_TIMERS ) { try { timer = ( MediaTimer ) Class . forName ( timerClass ) . newInstance ( ) ; break ; } catch ( Throwable t ) { // try the next one } } if ( timer == null ) { log . info ( "Can't use high performance timer, reverting to " + "System.currentTimeMillis() based timer." ) ; timer = new MillisTimer ( ) ; } return timer ; }
Attempts to create a high resolution timer but if that isn t possible uses a System . currentTimeMillis based timer .