Code example for AtomicLong

Methods: getAndAdd

0
    public String doRoute(Object columnValue) throws SQLException {
 
        if (pattern != null) {
 
            // 计算业务名称 
            int value = (int) (counter.getAndAdd(1) % count);
 
            String name = MessageFormat.format(pattern, value);
 
            // 输出日志 
            if (logger.isDebugEnabled()) {
                logger.debug("Routing to: " + name);
            } 
 
            return name;
        } 
 
        return null; 
    } 
} 
Connect your IDE to all the code out there  Get Codota for Java