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

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

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

ConcurrentSkipListMap.containsKey介绍

[英]Returns true if this map contains a mapping for the specified key.
[中]如果此映射包含指定键的映射,则返回true。

代码示例

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

@Override
public boolean containsKey(Object e) {
 return map.containsKey(e);
}

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

@Override
public boolean containsKey(K key) {
  return skipListMap.containsKey(key);
}

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

boolean containsTransaction(long tid) {
  return currentTransactions.containsKey(tid);
}

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

@VisibleForTesting
public boolean isRegionInRegionStates(final RegionInfo hri) {
 return (regionsMap.containsKey(hri.getRegionName()) || regionInTransition.containsKey(hri)
   || regionOffline.containsKey(hri));
}

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

public boolean containsKey(Object key) {
  if (key == null) throw new NullPointerException();
  K k = (K)key;
  return inBounds(k) && m.containsKey(k);
}

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

/**
 * @param top Topology.
 * @throws Exception If failed.
 */
void onTopologyChange(ZkClusterNodes top) throws Exception {
  for (Map.Entry<Long, GridFutureAdapter<Boolean>> e : nodeFuts.entrySet()) {
    if (!top.nodesByOrder.containsKey(e.getKey()))
      e.getValue().onDone(false);
  }
  if (collectResFut != null)
    collectResFut.onTopologyChange(top);
}

代码示例来源: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/ignite

/**
 * @param top Current topology.
 * @throws Exception If listener call failed.
 */
void onTopologyChange(ZkClusterNodes top) throws Exception {
  if (remainingNodes.isEmpty())
    return;
  for (Iterator<Long> it = remainingNodes.iterator(); it.hasNext();) {
    Long nodeOrder = it.next();
    if (!top.nodesByOrder.containsKey(nodeOrder)) {
      it.remove();
      int remaining = remainingNodes.size();
      if (log.isInfoEnabled()) {
        log.info("ZkDistributedCollectDataFuture removed remaining failed node [node=" + nodeOrder +
          ", remaining=" + remaining +
          ", futPath=" + futPath + ']');
      }
      if (remaining == 0) {
        completeAndNotifyListener();
        break;
      }
    }
  }
}

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

public synchronized void saveSnapshot(final Snapshot<T> snapshot) {
  if (snapshots.containsKey(snapshot.getVersion())) {
    return;
  }
  final File tmpFile = tmpFile();
  try {
    Files.write(serde.toBytes(snapshot.getData()), tmpFile);
  } catch (IOException e) {
    LOG.error("write data into tmp snapshot file failed. file: {}", tmpFile, e);
    throw new RuntimeException("write snapshot data failed.", e);
  }
  final File snapshotFile = getSnapshotFile(snapshot);
  if (!tmpFile.renameTo(snapshotFile)) {
    LOG.error("Move tmp as snapshot file failed. tmp: {}, snapshot: {}", tmpFile, snapshotFile);
    throw new RuntimeException("Move tmp as snapshot file failed.");
  }
  snapshots.put(snapshot.getVersion(), snapshot);
}

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

@Override
public Entry getEntry(Object key) {
 if (map.containsKey(key)) {
  return new EntryImpl(toDeserializable(key), (CachedDeserializable) map.get(key));
 } else {
  return null;
 }
}

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

private DelaySegment<T> allocNewSegment(long offset) {
  long baseOffset = resolveSegment(offset, segmentScale);
  if (segments.containsKey(baseOffset)) {
    return segments.get(baseOffset);
  }
  return allocSegment(baseOffset);
}

代码示例来源:origin: twitter/distributedlog

@Override
public void onSuccess(Set<URI> uris) {
  for (URI uri : uris) {
    if (subNamespaces.containsKey(uri)) {
      continue;
    }
    SubNamespace subNs = new SubNamespace(uri);
    if (null == subNamespaces.putIfAbsent(uri, subNs)) {
      subNs.watch();
      logger.info("Watched new sub namespace {}.", uri);
      notifyOnNamespaceChanges();
    }
  }
}

代码示例来源:origin: googleapis/google-cloud-java

synchronized Response testPermissions(String projectId, List<String> permissions) {
 if (!projects.containsKey(projectId)) {
  return Error.PERMISSION_DENIED.response("Project " + projectId + " not found.");
 }
 try {
  return new Response(
    HTTP_OK,
    jsonFactory.toString(new TestIamPermissionsResponse().setPermissions(permissions)));
 } catch (IOException e) {
  return Error.INTERNAL_ERROR.response("Error when serializing permissions " + permissions);
 }
}

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

Long internalId = e.getKey();
if (!rtState.top.nodesByInternalId.containsKey(internalId)) {
  UUID rslvFutId = rtState.evtsData.communicationErrorResolveFutureId();

代码示例来源:origin: palantir/atlasdb

private void checkLogIfNeeded(long seq) throws TruncatedStateLogException, IOException {
  if (state.containsKey(seq)) {
    return;
  }
  if (seq < log.getLeastLogEntry()) {
    throw new TruncatedStateLogException("round " + seq + " before truncation cutoff of "
        + log.getLeastLogEntry());
  }
  if (seq <= log.getGreatestLogEntry()) {
    byte[] bytes = log.readRound(seq);
    if (bytes != null) {
      state.put(seq, PaxosAcceptorState.BYTES_HYDRATOR.hydrateFromBytes(bytes));
    }
  }
}

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

public boolean containsKey(Object key) {
  if (key == null) throw new NullPointerException();
  K k = (K)key;
  return inBounds(k) && m.containsKey(k);
}

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

public boolean containsKey(Object key) {
  if (key == null) throw new NullPointerException();
  K k = (K)key;
  return inBounds(k) && m.containsKey(k);
}

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

public boolean containsKey(Object key) {
  if (key == null) throw new NullPointerException();
  K k = (K)key;
  return inBounds(k) && m.containsKey(k);
}

代码示例来源:origin: cinchapi/concourse

@Override
public boolean containsKey(Object key) {
  int seg = getSegment(key);
  long stamp = segmentLocks[seg].readLock();
  try {
    return segments[seg].containsKey(key) || sorted.containsKey(key);
  }
  finally {
    segmentLocks[seg].unlock(stamp);
  }
}

代码示例来源:origin: laforge49/JActor

@Override
public Object getProperty(String propertyName)
    throws Exception {
  if (properties.containsKey(propertyName))
    return properties.get(propertyName);
  Actor targetActor = getParent();
  if (targetActor != null)
    targetActor = targetActor.getMatch(Properties.class);
  if (targetActor == null)
    return null;
  return ((Properties) targetActor).getProperty(propertyName);
}

相关文章

微信公众号

最新文章

更多

ConcurrentSkipListMap类方法