public void updateInterval ( final long interval ) throws MetricException { if ( ! isValidInterval ( interval ) ) { throw new MetricException ( "Invalid interval: Cannot update timer" ) ; } logger . debug ( String . format ( "Updating tracking interval to %d milisecond for %s metric" , interval , getName ( ) ) ) ; this . timer . cancel ( ) ; this . timer = new Timer ( ) ; this . timer . schedule ( getTimerTask ( ) , interval , interval ) ; }
Method to change tracking interval