class AutonomicClusterManagementService {

    @Transactional(readOnly = false)
    @Scheduled(initialDelay = ONE_MINUTE_IN_MILLISECONDS, fixedDelay = ONE_MINUTE_IN_MILLISECONDS * NUMBER_OF_MINUTES_BETWEEN_CHECKS)
    public void removeClusterStuckProcessing() {
        List<ClusterVO> allClusters = clusterDao.listAll();
        if (CollectionUtils.isEmpty(allClusters)) {
            return;
        }
        for (ClusterVO cluster : allClusters) {
            final long clusterId = cluster.getId();
            if (!ClusterAdministrationStatus.isClusterBeingManaged(clusterDaoJdbc.getClusterAdministrationStatus(clusterId))) {
                continue;
            }
            Date lastAdministration = clusterDaoJdbc.getClusterLastAdminstration(clusterId);
            if (lastAdministration == null) {
                markAdministrationStatusInClusterAsDone(clusterId);
                continue;
            }
            Calendar cal = Calendar.getInstance();
            cal.setTime(lastAdministration);
            cal.add(Calendar.HOUR_OF_DAY, 6);

            Date now = new Date();
            if (cal.getTime().before(now)) {
                markAdministrationStatusInClusterAsDone(clusterId);
            }
        }
    }

}