question: @ Scheduled ( fixedDelay = 5000 ) public void deleteHistoricData ( ) { log . debug ( "start delete historic data" ) ; List < Check > checks = checkService . findAll ( ) ; for ( Check check : checks ) { GregorianCalendar calendar = new GregorianCalendar ( ) ; switch ( check . getKeepResultType ( ) ) { case MONTH : calendar . add ( Calendar . MONTH , - check . getKeepResultsValue ( ) ) ; break ; case DAY : calendar . add ( Calendar . DATE , - check . getKeepResultsValue ( ) ) ; break ; case HOUR : calendar . add ( Calendar . HOUR , - check . getKeepResultsValue ( ) ) ; break ; case MINUTE : calendar . add ( Calendar . MINUTE , - check . getKeepResultsValue ( ) ) ; break ; case SECOND : calendar . add ( Calendar . SECOND , - check . getKeepResultsValue ( ) ) ; break ; default : throw new UnsupportedOperationException ( "Unknown keep results type" ) ; } checkResultService . deleteOld ( check . getId ( ) , calendar . getTime ( ) ) ; } log . debug ( "finish delete historic data" ) ; }
target:  Each hour delete old statistics