AtomicLong seqSeed = new AtomicLong(1L);public long newSeq() {return (seqSeed.incrementAndGet() << cfg.leftOffset) + cfg.keyValue;}我想限定最大值.比如最大值为1000;if(seqSeed.incrementAndGet()>=1000){seqSeed=new AtomicLong(1L);}能这么写?
不能 ,if要加同步