java.util.concurrent.ConcurrentHashMap.segmentAt()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中java.util.concurrent.ConcurrentHashMap.segmentAt()方法的一些代码示例,展示了ConcurrentHashMap.segmentAt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ConcurrentHashMap.segmentAt()方法的具体详情如下:
包路径:java.util.concurrent.ConcurrentHashMap
类名称:ConcurrentHashMap
方法名:segmentAt

ConcurrentHashMap.segmentAt介绍

[英]Gets the jth element of given segment array (if nonnull) with volatile element access semantics via Unsafe. (The null check can trigger harmlessly only during deserialization.) Note: because each element of segments array is set only once (using fully ordered writes), some performance-sensitive methods rely on this method only as a recheck upon null reads.
[中]获取给定段数组的第jth个元素(如果非null),该元素通过不安全的方式具有易失性元素访问语义。(空检查只能在反序列化过程中无害地触发。)注意:由于segments数组的每个元素只设置一次(使用完全有序的写入),因此一些性能敏感的方法仅依赖于此方法作为对空读取的重新检查。

代码示例

代码示例来源:origin: robovm/robovm

final Segment<K,V>[] segments = this.segments;
for (int j = 0; j < segments.length; ++j) {
  Segment<K,V> seg = segmentAt(segments, j);
  if (seg != null) {
    if (seg.count != 0)
    Segment<K,V> seg = segmentAt(segments, j);
    if (seg != null) {
      if (seg.count != 0)

代码示例来源:origin: robovm/robovm

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: robovm/robovm

Segment<K,V> seg = segmentAt(segments, k);
seg.lock();
try {

代码示例来源:origin: robovm/robovm

lockCount++;
} else {
  segment = segmentAt(segments, j);
  if (segment == null)
    continue;

代码示例来源:origin: robovm/robovm

long size = 0L;
for (int i = 0; i < segmentCount; i++) {
  Segment<K,V> segment = segmentAt(segments, i);
  if (segment != null) {
    sum += segment.modCount;

代码示例来源:origin: com.bugvm/bugvm-rt

final Segment<K,V>[] segments = this.segments;
for (int j = 0; j < segments.length; ++j) {
  Segment<K,V> seg = segmentAt(segments, j);
  if (seg != null) {
    if (seg.count != 0)
    Segment<K,V> seg = segmentAt(segments, j);
    if (seg != null) {
      if (seg.count != 0)

代码示例来源:origin: MobiVM/robovm

final Segment<K,V>[] segments = this.segments;
for (int j = 0; j < segments.length; ++j) {
  Segment<K,V> seg = segmentAt(segments, j);
  if (seg != null) {
    if (seg.count != 0)
    Segment<K,V> seg = segmentAt(segments, j);
    if (seg != null) {
      if (seg.count != 0)

代码示例来源:origin: MobiVM/robovm

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: com.jtransc/jtransc-rt

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K, V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K, V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: org.codehaus.jsr166-mirror/jsr166

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Removes all of the mappings from this map.
 */
public void clear() {
  final Segment<K,V>[] segments = this.segments;
  for (int j = 0; j < segments.length; ++j) {
    Segment<K,V> s = segmentAt(segments, j);
    if (s != null)
      s.clear();
  }
}

代码示例来源:origin: MobiVM/robovm

Segment<K,V> seg = segmentAt(segments, k);
seg.lock();
try {

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

Segment<K,V> seg = segmentAt(segments, k);
seg.lock();
try {

代码示例来源:origin: com.jtransc/jtransc-rt

Segment<K, V> seg = segmentAt(segments, k);
seg.lock();
try {

代码示例来源:origin: MobiVM/robovm

long size = 0L;
for (int i = 0; i < segmentCount; i++) {
  Segment<K,V> segment = segmentAt(segments, i);
  if (segment != null) {
    sum += segment.modCount;

代码示例来源:origin: ibinti/bugvm

long size = 0L;
for (int i = 0; i < segmentCount; i++) {
  Segment<K,V> segment = segmentAt(segments, i);
  if (segment != null) {
    sum += segment.modCount;

相关文章

微信公众号

最新文章

更多