moved to package

This commit is contained in:
Alexey Kudravtsev
2011-08-03 15:19:28 +04:00
parent 3321d8938c
commit f9d84f58aa
2 changed files with 4 additions and 5 deletions
@@ -21,7 +21,6 @@ import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.editor.ex.RangeMarkerEx;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.util.DistributedCounter;
import com.intellij.util.Processor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -33,7 +32,7 @@ public class RangeMarkerImpl extends UserDataHolderBase implements RangeMarkerEx
protected RangeMarkerTree.RMNode myNode;
private final long myId;
private static final DistributedCounter counter = new DistributedCounter();
private static final StripedIDGenerator counter = new StripedIDGenerator();
protected RangeMarkerImpl(@NotNull DocumentEx document, int start, int end, boolean register) {
this(document, start, end, register, false, false);
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util;
package com.intellij.openapi.editor.impl;
import java.util.concurrent.atomic.AtomicLong;
@@ -21,10 +21,10 @@ import java.util.concurrent.atomic.AtomicLong;
* Low-contention counter.
* Repeated calls to {@link #next()} return numbers which are unique across all calling threads, and which are increasing over calls within one thread.
*/
public class DistributedCounter {
public class StripedIDGenerator {
private static final int CHUNK_SIZE = 1000;
private final AtomicLong nextChunkStart = new AtomicLong();
// must not ne static
// must not be static since we might want to have several instances of this class
private final ThreadLocal<NextPair> localCounter = new ThreadLocal<NextPair>();
private static class NextPair {
long nextId;