public int incrementCounter ( final StackifyError error , long epochMinute ) { if ( error == null ) { throw new NullPointerException ( "StackifyError is null" ) ; } ErrorItem baseError = getBaseError ( error ) ; String uniqueKey = getUniqueKey ( baseError ) ; // get the counter for this error int count = 0 ; if ( errorCounter . containsKey ( uniqueKey ) ) { // counter exists MinuteCounter counter = errorCounter . get ( uniqueKey ) ; if ( counter . getEpochMinute ( ) == epochMinute ) { // counter exists for this current minute // increment the counter MinuteCounter incCounter = MinuteCounter . incrementCounter ( counter ) ; errorCounter . put ( uniqueKey , incCounter ) ; count = incCounter . getErrorCount ( ) ; } else { // counter did not exist for this minute // overwrite the entry with a new one MinuteCounter newCounter = MinuteCounter . newMinuteCounter ( epochMinute ) ; errorCounter . put ( uniqueKey , newCounter ) ; count = newCounter . getErrorCount ( ) ; } } else { // counter did not exist so create a new one MinuteCounter newCounter = MinuteCounter . newMinuteCounter ( epochMinute ) ; errorCounter . put ( uniqueKey , newCounter ) ; count = newCounter . getErrorCount ( ) ; } return count ; }
Increments the counter for this error in the epoch minute specified