(long delta)
| 69 | } |
| 70 | |
| 71 | public long getAndAdd(long delta) { |
| 72 | while (true) { |
| 73 | long current = value; |
| 74 | long next = current + delta; |
| 75 | if (compareAndSet(current, next)) { |
| 76 | return current; |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | public long getAndIncrement() { |
| 82 | return getAndAdd(1); |
no test coverage detected