private IntervalListener getListener ( String intervalName ) { IntervalListener listener = listeners . get ( intervalName ) ; if ( listener != null ) return listener ; try { Interval interval = IntervalRegistry . getInstance ( ) . getIntervalOnlyIfExisting ( intervalName ) ; listener = new IntervalListener ( ) ; IntervalListener old = listeners . putIfAbsent ( intervalName , listener ) ; if ( old != null ) return old ; interval . addSecondaryIntervalListener ( listener ) ; return listener ; } catch ( UnknownIntervalException e ) { return NoIntervalListener . INSTANCE ; } }
Returns interval listener for the specified interval . If there already was a listener it will be returned otherwise a new one will be created . However if there have been no such interval the interval listener will be substituted for a dummy object and no further action will be taken .