com.hazelcast.core.IMap.removeAll()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(158)

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

IMap.removeAll介绍

[英]Removes all entries which match with the supplied predicate.

If this map has index, matching entries will be found via index search, otherwise they will be found by full-scan.

Note that calling this method also removes all entries from caller's Near Cache.

Interactions with the map store

If write-through persistence mode is configured, before a value is removed from the memory, MapStore#delete(Object) is called to remove the value from the map store. Exceptions thrown by delete fail the operation and are propagated to the caller.

If write-behind persistence mode is configured with write-coalescing turned off, com.hazelcast.map.ReachedMaxSizeException may be thrown if the write-behind queue has reached its per-node maximum capacity.
[中]删除与提供的谓词匹配的所有条目。
如果此地图具有索引,则将通过索引搜索找到匹配的条目,否则将通过完全扫描找到它们。
请注意,调用此方法还将从调用者的近缓存中删除所有条目。
与地图商店的交互
如果配置了直写持久化模式,则在从内存中删除值之前,将调用MapStore#delete(对象)以从映射存储中删除该值。delete引发的异常使操作失败,并传播到调用方。
如果将写后持久化模式配置为关闭写合并,则com。黑泽尔卡斯特。地图如果写后队列已达到其每个节点的最大容量,则可能引发ReacheMaxSizeException。

代码示例

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public void removeAll(Predicate<K, V> predicate) {
  map.removeAll(predicate);
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
@SuppressWarnings("unchecked")
public void removeAll() {
  map.removeAll(TruePredicate.INSTANCE);
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
@SuppressWarnings("unchecked")
public void removeAll() {
  map.removeAll(TruePredicate.INSTANCE);
}

代码示例来源:origin: dsukhoroslov/bagri

void removeQueryResults(Collection<Integer> queryIds) {
  int oSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.enter; got queryIds: {}; result cache size: {}", queryIds, oSize);
  xrCache.removeAll(new ResultsQueryPredicate(queryIds));
  int nSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.exit; deleted {} results; new size is: {}", oSize - nSize, nSize);
}

代码示例来源:origin: dsukhoroslov/bagri

void removeQueryResults(long docId) {
  int oSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.enter; got docId: {}; result cache size: {}", docId, oSize);
  xrCache.removeAll(new ResultsDocPredicate(docId));
  //xrCache.removeAll(Predicates.equal("docId", docId));
  int nSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.exit; deleted {} results for docId: {}; new size is: {}", oSize - nSize, docId, nSize);
}

代码示例来源:origin: dsukhoroslov/bagri

void removeQueryResults(int queryId, PathExpression pex, Elements elts) {
  int oSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.enter; got queryId: {}; result cache size: {}", queryId, oSize);
  xrCache.removeAll(new ResultsQueryParamsPredicate(queryId, pex, elts));
  int nSize = logger.isTraceEnabled() ? xrCache.size() : 0;
  logger.trace("removeQueryResults.exit; deleted {} results; new size is: {}", oSize - nSize, nSize);
}

代码示例来源:origin: kloiasoft/eventapis

@Override
boolean runInternal(StopWatch stopWatch) throws InterruptedException, ExecutionException {
  stopWatch.start("adminClient.listTopics()");
  Collection<String> topicNames = adminClient.listTopics().listings().get()
      .stream().map(TopicListing::name).filter(this::shouldCollectEvent).collect(Collectors.toList());
  topicsMap.removeAll(new RemoveTopicPredicate(topicNames));
  DescribeTopicsResult describeTopicsResult = adminClient.describeTopics(topicNames);
  describeTopicsResult.all().get().forEach(
      (topic, topicDescription) -> topicsMap.executeOnKey(topic, new SetTopicPartitionsProcessor(
          topicDescription.partitions().stream().map(TopicPartitionInfo::partition).collect(Collectors.toList()))
      )
  );
  metaMap.set(this.getName() + TopicServiceScheduler.LAST_SUCCESS_PREFIX, System.currentTimeMillis());
  log.debug("Topics:" + topicsMap.entrySet());
  log.debug(stopWatch.prettyPrint());
  return true;
}

代码示例来源:origin: hazelcast/hazelcast-jet

/**
 * Performs cleanup after job completion. Deletes job record and job resources but keeps the job id
 * so that it will not be used again for a new job submission.
 */
void deleteJob(long jobId) {
  if (deletedJobs.contains(jobId)) {
    return;
  }
  // Delete the job record
  jobExecutionRecords.remove(jobId);
  jobRecords.remove(jobId);
  // Delete the execution ids, but keep the job id
  randomIds.removeAll(new FilterExecutionIdByJobIdPredicate(jobId));
  // Delete job resources
  cleanupJobResourcesAndSnapshots(jobId, getJobResources(jobId));
  deletedJobs.add(jobId);
}

相关文章