Java 类org.springframework.dao.NonTransientDataAccessException 实例源码

项目:cf-service-tester    文件:ConsistencyChecker.java   
@PostConstruct
void init() {
    try {
        for(int i=0; i<numPublishers; i++) {
            redisTemplate.delete(utils.getPublishedKey(i));
            redisTemplate.delete(utils.getPublishedZKey(i));
        }
    }
    catch(NonTransientDataAccessException ex) {
        log.error("Redis is not available. Is it down?");
    }
}
项目:cf-service-tester    文件:DuplicatesChecker.java   
@PostConstruct
void init() {
    if(redisTemplate != null) {
        try {
            for(int i=0; i<numConsumers; i++) {
                redisTemplate.delete(utils.getReceivedKey(i));
            }
        }
        catch(NonTransientDataAccessException ex) {
            log.error("Redis is not available. Is it down?");
        }
    }
}
项目:whois    文件:DailySchedulerDao.java   
public boolean acquireDailyTask(final LocalDate date, final Class taskClass, final String hostName) {
    final List<Long> finishDate = jdbcTemplate.queryForList("SELECT done FROM scheduler WHERE date = ? AND task = ?", Long.class, date.minusDays(1).toString(), taskClass.getSimpleName());
    if (finishDate.size() > 0 && finishDate.get(0) == null) {
        LOGGER.error("While trying to acquire ({}, {}): previous day's run (by {}) is not marked as finished!", date.toString(), taskClass.getSimpleName(), hostName);
    }

    try {
        jdbcTemplate.update("INSERT INTO scheduler (date, task, host) VALUES (?, ?, ?)", date.toString(), taskClass.getSimpleName(), hostName);
    } catch (NonTransientDataAccessException ignored) {
        LOGGER.debug("Scheduled task already run on different cluster member", ignored);
        return false;
    }
    return true;
}