7184ba4328fe863930877fad1b0830cee497b5d8
java/com.sap.sse.common/src/com/sap/sse/common/scalablevalue/KadaneExtremeSubsequenceFinderLinkedNodesImpl.java
| ... | ... | @@ -7,6 +7,7 @@ import java.io.Serializable; |
| 7 | 7 | import java.util.Collections; |
| 8 | 8 | import java.util.Iterator; |
| 9 | 9 | import java.util.TreeSet; |
| 10 | +import java.util.concurrent.atomic.AtomicInteger; |
|
| 10 | 11 | import java.util.function.BiFunction; |
| 11 | 12 | import java.util.function.Consumer; |
| 12 | 13 | import java.util.function.Function; |
| ... | ... | @@ -63,7 +64,7 @@ public class KadaneExtremeSubsequenceFinderLinkedNodesImpl<ValueType, AveragesTo |
| 63 | 64 | */ |
| 64 | 65 | private static class Node<ValueType, AveragesTo extends Comparable<AveragesTo>, T extends ComparableScalableValueWithDistance<ValueType, AveragesTo>> implements Serializable { |
| 65 | 66 | private static final long serialVersionUID = -2547142048423135013L; |
| 66 | - private static int idCounter = 0; |
|
| 67 | + private static final AtomicInteger idCounter = new AtomicInteger(0); |
|
| 67 | 68 | private final T value; |
| 68 | 69 | private final int id; |
| 69 | 70 | private transient Node<ValueType, AveragesTo, T> previous; |
| ... | ... | @@ -75,7 +76,7 @@ public class KadaneExtremeSubsequenceFinderLinkedNodesImpl<ValueType, AveragesTo |
| 75 | 76 | |
| 76 | 77 | private Node(Node<ValueType, AveragesTo, T> previous, Node<ValueType, AveragesTo, T> next, T value) { |
| 77 | 78 | super(); |
| 78 | - id = idCounter++; |
|
| 79 | + id = idCounter.getAndIncrement(); |
|
| 79 | 80 | this.previous = previous; |
| 80 | 81 | this.next = next; |
| 81 | 82 | this.value = value; |