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

x33g5p2x  于2022-01-18 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(157)

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

ConcurrentSkipListMap.remove介绍

[英]Removes the mapping for the specified key from this map if present.
[中]从此映射中删除指定键的映射(如果存在)。

代码示例

代码示例来源:origin: apache/hbase

public void removeFromOfflineRegions(final RegionInfo regionInfo) {
 regionOffline.remove(regionInfo);
}

代码示例来源:origin: apache/geode

@Override
public void remove(Object key) {
 map.remove(key);
}

代码示例来源:origin: Alluxio/alluxio

public void removeChild(String name) {
  if (mChildren != null && mChildren.remove(name) != null) {
   mWeight.decrementAndGet();
  }
 }
}

代码示例来源:origin: apache/ignite

/**
 * This method is not supported and always throws {@link UnsupportedOperationException}.
 *
 * @param o {@inheritDoc}
 * @return {@inheritDoc}
 */
@Override public V remove(Object o) {
  V old = super.remove(o);
  if (old != null)
    cnt.decrementAndGet();
  return old;
}

代码示例来源:origin: apache/ignite

/**
 * This method is not supported and always throws {@link UnsupportedOperationException}.
 *
 * @param key {@inheritDoc}
 * @param val {@inheritDoc}
 * @return {@inheritDoc}
 */
@Override public boolean remove(Object key, Object val) {
  boolean rmvd = super.remove(key, val);
  if (rmvd)
    cnt.decrementAndGet();
  return rmvd;
}

代码示例来源:origin: apache/incubator-druid

@Override
public void removeSegment(DataSegment segment, DataSegmentChangeCallback callback)
{
 updateSuccessOrFailureInHolder(segmentsToDrop.remove(segment), status);
}

代码示例来源:origin: apache/incubator-druid

@Override
public void addSegment(DataSegment segment, DataSegmentChangeCallback callback)
{
 updateSuccessOrFailureInHolder(segmentsToLoad.remove(segment), status);
}

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

private static void doCheckFree( long pointer )
{
  long count = freeCounter.getAndIncrement();
  Allocation allocation = allocations.remove( pointer );
  if ( allocation == null )
  {
    StringBuilder sb = new StringBuilder( format( "Bad free: 0x%x, valid pointers are:", pointer ) );
    allocations.forEach( ( k, v ) -> sb.append( '\n' ).append( k ) );
    throw new AssertionError( sb.toString() );
  }
  int idx = (int) (count & 4095);
  freeTraces[idx] = new FreeTrace( pointer, allocation, count );
}

代码示例来源:origin: apache/hbase

public void deleteRegion(final RegionInfo regionInfo) {
 regionsMap.remove(regionInfo.getRegionName());
 // See HBASE-20860
 // After master restarts, merged regions' RIT state may not be cleaned,
 // making sure they are cleaned here
 if (regionInTransition.containsKey(regionInfo)) {
  regionInTransition.remove(regionInfo);
 }
 // Remove from the offline regions map too if there.
 if (this.regionOffline.containsKey(regionInfo)) {
  if (LOG.isTraceEnabled()) LOG.trace("Removing from regionOffline Map: " + regionInfo);
  this.regionOffline.remove(regionInfo);
 }
}

代码示例来源:origin: apache/hbase

public void removeFromFailedOpen(final RegionInfo regionInfo) {
 regionFailedOpen.remove(regionInfo.getRegionName());
}

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

public V remove(Object key) {
  K k = (K)key;
  return (!inBounds(k)) ? null : m.remove(k);
}

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

public boolean remove(Object key, Object value) {
  K k = (K)key;
  return inBounds(k) && m.remove(k, value);
}

代码示例来源:origin: lealone/Lealone

@Override
public V remove(K key) {
  Object v1 = buffer.remove(key);
  Object v2 = map.remove(key);
  if (v1 == null)
    v1 = v2;
  return (V) v1;
}

代码示例来源:origin: apache/storm

@Override
public void invalidate(K key) {
  try {
    lock.lock();
    if (isPinned(key)) {
      LOG.debug("Entry '{}' is pinned, skipping invalidation", key);
    } else {
      LOG.debug("Invalidating entry '{}'", key);
      V val = map.remove(key);
      if (val != null) {
        --size;
        pinned.remove(key);
        if (removalListener != null) {
          removalListener.onRemoval(key, val, RemovalCause.EXPLICIT);
        }
      }
    }
  } finally {
    lock.unlock();
  }
}

代码示例来源:origin: apache/ignite

/**
   * @param internalId Node internal ID.
   * @return Removed node.
   */
  ZookeeperClusterNode removeNode(long internalId) {
    ZookeeperClusterNode node = nodesByInternalId.remove(internalId);

    assert node != null : internalId;
    assert node.order() > 0 : node;

    Object rvmd = nodesByOrder.remove(node.order());

    assert rvmd != null;

    rvmd = nodesById.remove(node.id());

    assert rvmd != null;

    return node;
  }
}

代码示例来源:origin: lealone/Lealone

public synchronized void merge() {
  for (Entry<Object, Object> entry : buffer.entrySet()) {
    Object key = entry.getKey();
    Object value = entry.getValue();
    map.put((K) key, (V) value);
    // 执行完put后,可能又有相同key的值来了,此时不能删,只有跟原来相同时才删
    buffer.remove(key, value);
  }
}

代码示例来源:origin: apache/incubator-druid

private void actionCompleted()
{
 if (currentlyProcessing != null) {
  switch (currentlyProcessing.getType()) {
   case LOAD:
    segmentsToLoad.remove(currentlyProcessing.getSegment());
    queuedSize.addAndGet(-currentlyProcessing.getSegmentSize());
    break;
   case DROP:
    segmentsToDrop.remove(currentlyProcessing.getSegment());
    break;
   default:
    throw new UnsupportedOperationException();
  }
  final List<LoadPeonCallback> callbacks = currentlyProcessing.getCallbacks();
  currentlyProcessing = null;
  callBackExecutor.execute(
    () -> executeCallbacks(callbacks)
  );
 }
}

代码示例来源:origin: qunarcorp/qmq

private boolean deleteSegment(final long key, final LogSegment segment) {
  if (!segment.release()) return false;
  segments.remove(key);
  segment.destroy();
  return true;
}

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

public void clear() {
  for (ConcurrentSkipListMap.Node<K,V> n = loNode();
     isBeforeEnd(n);
     n = n.next) {
    if (n.getValidValue() != null)
      m.remove(n.key);
  }
}

代码示例来源:origin: apache/hbase

@Test
public void testRemove() throws Exception {
 for (Map.Entry<Long, Long> e:csm.entrySet()) {
  assertEquals(csm.remove(e.getKey()), m.remove(e.getKey()));
  assertEquals(null, m.remove(e.getKey()));
 }
}

相关文章

ConcurrentSkipListMap类方法