@ Override protected synchronized CollectionContext beginCollection ( DateTime now ) { data_ . startNewCycle ( now , getDecoratorLookBack ( ) ) ; return new CollectionContext ( ) { final Map < GroupName , Alert > alerts = new HashMap <> ( ) ; @ Override public Consumer < Alert > alertManager ( ) { return ( Alert alert ) -> { Alert combined = combine_alert_with_past_ ( alert , alerts_ ) ; alerts . put ( combined . getName ( ) , combined ) ; } ; } @ Override public MutableTimeSeriesCollectionPair tsdata ( ) { return data_ ; } /** * Store a newly completed collection cycle. */ @ Override public void commit ( ) { alerts_ = unmodifiableMap ( alerts ) ; try { getHistory ( ) . ifPresent ( history -> history . add ( getCollectionData ( ) ) ) ; } catch ( Exception ex ) { logger . log ( Level . WARNING , "unable to add collection data to history (dropped)" , ex ) ; } } } ; }
Begin a new collection cycle .