private void init ( ) { errorProducerEnabled = MoskitoConfigurationHolder . getConfiguration ( ) . getBuiltinProducersConfig ( ) . isErrorProducer ( ) ; statsMap = new ConcurrentHashMap <> ( ) ; statsList = new CopyOnWriteArrayList <> ( ) ; cumulatedStats = new ErrorStats ( "cumulated" ) ; statsList . add ( cumulatedStats ) ; catchers = new ConcurrentHashMap <> ( ) ; //it is complicated to actually remove the error producer from the system if disabled, but the flag renders it invisible and //disables most methos. if ( ! errorProducerEnabled ) return ; ProducerRegistryFactory . getProducerRegistryInstance ( ) . registerProducer ( this ) ; //add charts for cumulated errors. AfterStartTasks . submitTask ( new Runnable ( ) { @ Override public void run ( ) { AccumulatorRepository . getInstance ( ) . createAccumulator ( createAccumulatorDefinition ( "Errors.Cumulated.Total" , "total" , "cumulated" ) ) ; } } ) ; AfterStartTasks . submitTask ( new Runnable ( ) { @ Override public void run ( ) { AccumulatorRepository . getInstance ( ) . createAccumulator ( createAccumulatorDefinition ( "Errors.Cumulated.Initial" , "initial" , "cumulated" ) ) ; } } ) ; errorHandlingConfig = null ; }
Initialization . Moved out to be reused in unit - tests .