private Interval createInterval ( String aName , int aLength ) { if ( aName . equals ( "1m" ) ) { System . out . println ( "CREATE INTERVAL 1M CALLED " ) ; new RuntimeException ( ) . fillInStackTrace ( ) . printStackTrace ( ) ; } IntervalImpl interval = new IntervalImpl ( obtainNextUniqueId ( ) , aName , aLength ) ; if ( aLength != - 1 ) updateTriggerService . addUpdateable ( interval , aLength ) ; intervalsById . put ( interval . getId ( ) , interval ) ; intervalsByName . put ( interval . getName ( ) , interval ) ; for ( IntervalRegistryListener listener : registryListeners ) { listener . intervalCreated ( interval ) ; } //add new listener to each interval to store update timestamps interval . addSecondaryIntervalListener ( new IIntervalListener ( ) { @ Override public void intervalUpdated ( Interval aCaller ) { intervalUpdateTimestamp . put ( aCaller . getName ( ) , System . currentTimeMillis ( ) ) ; } } ) ; return interval ; }
This method creates a new Interval with the given name and length .