01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.objectserver.persistence.impl;
06:
07: import com.tc.exception.ImplementMe;
08: import com.tc.util.Assert;
09: import com.tc.util.concurrent.NoExceptionLinkedQueue;
10: import com.tc.util.sequence.MutableSequence;
11:
12: public final class TestMutableSequence implements MutableSequence {
13:
14: public long sequence = 0;
15: public final NoExceptionLinkedQueue nextBatchQueue = new NoExceptionLinkedQueue();
16:
17: public long next() {
18: return ++sequence;
19: }
20:
21: public long current() {
22: return sequence;
23: }
24:
25: public long nextBatch(int batchSize) {
26: nextBatchQueue.put(new Object[] { new Integer(batchSize) });
27: long ls = sequence;
28: sequence += batchSize;
29: return ls;
30: }
31:
32: public String getUID() {
33: throw new ImplementMe();
34: }
35:
36: public void setNext(long next) {
37: Assert.assertTrue(this.sequence <= next);
38: sequence = next;
39: }
40:
41: }
|