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

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

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

ConcurrentHashMap.clear介绍

[英]Removes all of the mappings from this map.
[中]从此映射中删除所有映射。

代码示例

代码示例来源:origin: google/guava

/**
 * Removes all of the mappings from this map. The map will be empty after this call returns.
 *
 * <p>This method is not atomic: the map may not be empty after returning if there were concurrent
 * writes.
 */
public void clear() {
 map.clear();
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Clears all the computed values.
 */
public void clear() {
  store.clear();
}

代码示例来源:origin: prestodb/presto

/**
 * Removes all of the mappings from this map. The map will be empty after this call returns.
 *
 * <p>This method is not atomic: the map may not be empty after returning if there were concurrent
 * writes.
 */
public void clear() {
 map.clear();
}

代码示例来源:origin: prestodb/presto

/**
 * Method that will drop all dynamically constructed deserializers (ones that
 * are counted as result value for {@link #cachedDeserializersCount}).
 * This can be used to remove memory usage (in case some deserializers are
 * only used once or so), or to force re-construction of deserializers after
 * configuration changes for mapper than owns the provider.
 */
public void flushCachedDeserializers() {
  _cachedDeserializers.clear();       
}

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

/**
 * Method that will drop all dynamically constructed deserializers (ones that
 * are counted as result value for {@link #cachedDeserializersCount}).
 * This can be used to remove memory usage (in case some deserializers are
 * only used once or so), or to force re-construction of deserializers after
 * configuration changes for mapper than owns the provider.
 */
public void flushCachedDeserializers() {
  _cachedDeserializers.clear();       
}

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

/**
 * clear global deduplication caches. Useful for class reloading scenarios, else counter productive as
 * j.reflect.Fiwld + Construtors will be instantiated more than once per class.
 */
public static void clearGlobalCaches() {
  FSTClazzInfo.sharedFieldSets.clear();
  FSTDefaultClassInstantiator.constructorMap.clear();
}

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

/**
 * Clear all entries from the Cache. This typically happens right after becoming a leader, just to be sure
 * nothing has changed while we were not the leader.
 */
public void clear() {
  confs.clear();
  topos.clear();
}

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

@Override
  public void destroy() throws Exception {
    super.destroy();
    this.referenceBeanCache.clear();
    this.localReferenceBeanInvocationHandlerCache.clear();
    this.injectedFieldReferenceBeanCache.clear();
    this.injectedMethodReferenceBeanCache.clear();
  }
}

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

@Override
  public void destroy() throws Exception {
    super.destroy();
    this.referenceBeanCache.clear();
    this.localReferenceBeanInvocationHandlerCache.clear();
    this.injectedFieldReferenceBeanCache.clear();
    this.injectedMethodReferenceBeanCache.clear();
  }
}

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

@Override
public void clear() {
  delegateMap.clear();
  expireThread.stopExpiring();
}

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

@Override
public void reset()
{
  stopped.set( false );
  samples.clear();
  underSampling.set( 0 );
}

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

@Override
public void clear() {
  delegateMap.clear();
  expireThread.stopExpiring();
}

代码示例来源:origin: spring-projects/spring-framework

public void clearProperties() throws JMSException {
  this.properties.clear();
}

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

@Override
public void stop()
{
  boltSchedulers.values().forEach( this::stopScheduler );
  boltSchedulers.clear();
  forkJoinThreadPool.shutdown();
  forkJoinThreadPool = null;
}

代码示例来源:origin: prestodb/presto

private void closeCachedLookupSources()
{
  lock.writeLock().lock();
  try {
    suppliedLookupSources.values().forEach(LookupSource::close);
    suppliedLookupSources.clear();
  }
  finally {
    lock.writeLock().unlock();
  }
}

代码示例来源:origin: xuxueli/xxl-job

private static int count(int jobId) {
  // cache clear
  if (System.currentTimeMillis() > CACHE_VALID_TIME) {
    routeCountEachJob.clear();
    CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
  }
  // count++
  Integer count = routeCountEachJob.get(jobId);
  count = (count==null || count>1000000)?(new Random().nextInt(100)):++count;  // 初始化时主动Random一次,缓解首次压力
  routeCountEachJob.put(jobId, count);
  return count;
}

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

@Override
 public void clear()
 {
  delegate.clear();
 }
}

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

@Override
public void shutdown() {
  store.clear();
  if (backingStore != null) {
    backingStore.shutdown();
  }
}

代码示例来源:origin: Netflix/eureka

/**
 * Completely clear the registry.
 */
@Override
public void clearRegistry() {
  overriddenInstanceStatusMap.clear();
  recentCanceledQueue.clear();
  recentRegisteredQueue.clear();
  recentlyChangedQueue.clear();
  registry.clear();
}

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

@Override
  public void shutdown() {
    LOG.info("shutdown validateReadRequestVariant");
    cxidMap.clear();
    expectedZxid = new AtomicLong(1);
    if (nextProcessor!=null){
      nextProcessor.shutdown();
    }
  }
}

相关文章