import java.util.concurrent.atomic.AtomicLong; /** * * <pre> * Copyright (C): 2012 * * Description: * 序列的原子实现,可实现并发 * * Revision History: * * </pre> */ public class AtomicLongSequence implements ISequence { private SequenceEnum sequenceEnum; private AtomicLong al ; public AtomicLongSequence(String sequenceName){ this.sequenceEnum = Enum.valueOf(SequenceEnum.class, sequenceName); al = new AtomicLong(sequenceEnum.Init()); } public long getNextVal(){ return al.incrementAndGet(); } }
最近下载更多