mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
moved to package
This commit is contained in:
@@ -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);
|
||||
|
||||
+3
-3
@@ -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;
|
||||
Reference in New Issue
Block a user