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

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

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

ConcurrentSkipListSet.contains介绍

[英]Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that o.equals(e).
[中]如果此集合包含指定的元素,则返回true。更正式地说,当且仅当该集合包含元素e,使得o.equals(e)时,返回true。

代码示例

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

private boolean currentlyCreatingCache(T artifactLocation) {
  return pendingCacheFiles.contains(artifactLocation);
}

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

public boolean isAlreadyTriggered(CaseInsensitiveString pipelineName) {
  return triggeredPipelines.contains(pipelineName);
}

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

/**
 * Since the ack are delayed, we need to do some best-effort duplicate check to discard messages that are being
 * resent after a disconnection and for which the user has already sent an acknowlowdgement.
 */
public boolean isDuplicate(MessageId messageId) {
  if (messageId.compareTo(lastCumulativeAck) <= 0) {
    // Already included in a cumulative ack
    return true;
  } else {
    return pendingIndividualAcks.contains(messageId);
  }
}

代码示例来源:origin: igniterealtime/Openfire

/**
 * Returns true if the provided JID belongs to a user that is part of the group.
 *
 * @param user the JID address of the user to check.
 * @return true if the specified user is a group user.
 */
public boolean isUser(JID user) {
  // Make sure that we are always checking bare JIDs
  if (user != null && user.getResource() != null) {
    user = user.asBareJID();
  }
  return user != null && (members.contains(user) || administrators.contains(user));
}

代码示例来源:origin: ehcache/ehcache3

/**
 * Check wheather the given message id is already seen by track call.
 *
 * @param msgId Message Identifier to be checked.
 * @return true if the given msgId is already tracked otherwise false.
 */
public boolean seen(long msgId) {
 boolean seen = nonContiguousMsgIds.contains(msgId) || msgId <= highestContiguousMsgId;
 tryReconcile();
 return seen;
}

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

public void add(final ServiceName serviceName) {
  final ConcurrentSkipListSet<ServiceName> boundServices = this.boundServices;
  if (boundServices.contains(serviceName)) {
    throw NamingLogger.ROOT_LOGGER.serviceAlreadyBound(serviceName);
  }
  boundServices.add(serviceName);
}

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

private List<ServiceName> listChildren(final ServiceName name, boolean isContextBinding) throws NamingException {
  final ConcurrentSkipListSet<ServiceName> boundServices = this.boundServices;
  if (!isContextBinding && boundServices.contains(name)) {
    throw NamingLogger.ROOT_LOGGER.cannotListNonContextBinding();
  }
  final NavigableSet<ServiceName> tail = boundServices.tailSet(name);
  final List<ServiceName> children = new ArrayList<ServiceName>();
  for (ServiceName next : tail) {
    if (name.isParentOf(next)) {
      if (!name.equals(next)) {
        children.add(next);
      }
    } else {
      break;
    }
  }
  return children;
}

代码示例来源:origin: zhegexiaohuozi/SeimiCrawler

@Override
public boolean isProcessed(Request req) {
  ConcurrentSkipListSet<String> set = getProcessedSet(req.getCrawlerName());
  String sign = GenericUtils.signRequest(req);
  return set.contains(sign);
}

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

@Override
public void unregister(final String service)
{
 log.info("Unregistering chat handler[%s]", service);
 final ChatHandler handler = handlers.get(service);
 if (handler == null) {
  log.warn("handler[%s] not currently registered, ignoring.", service);
  return;
 }
 if (announcements.contains(service)) {
  try {
   serviceAnnouncer.unannounce(makeDruidNode(service));
  }
  catch (Exception e) {
   log.warn(e, "Failed to unregister service[%s]", service);
  }
  announcements.remove(service);
 }
 handlers.remove(service, handler);
}

代码示例来源:origin: igniterealtime/Openfire

alreadyGroupUser = members.contains(user);
alreadyGroupUser = administrators.contains(user);
    if (members.contains(user)) {
      members.remove(user);
    if (administrators.contains(user)) {
      administrators.remove(user);

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

/**
 * Steps:
 * 1. addSegment() succesfully loads the segment and annouces it
 * 2. removeSegment() unannounces the segment and schedules a delete runnable that deletes segment files
 * 3. addSegment() calls loadSegment() and annouces it again
 * 4. scheduled delete task executes and realizes it should not delete the segment files.
 */
@Test
public void testSegmentLoading2() throws Exception
{
 segmentLoadDropHandler.start();
 final DataSegment segment = makeSegment("test", "1", Intervals.of("P1d/2011-04-01"));
 segmentLoadDropHandler.addSegment(segment, DataSegmentChangeCallback.NOOP);
 Assert.assertTrue(segmentsAnnouncedByMe.contains(segment));
 segmentLoadDropHandler.removeSegment(segment, DataSegmentChangeCallback.NOOP);
 Assert.assertFalse(segmentsAnnouncedByMe.contains(segment));
 segmentLoadDropHandler.addSegment(segment, DataSegmentChangeCallback.NOOP);
 /*
   make sure the scheduled runnable that "deletes" segment files has been executed.
   Because another addSegment() call is executed, which removes the segment from segmentsToDelete field in
   ZkCoordinator, the scheduled runnable will not actually delete segment files.
  */
 for (Runnable runnable : scheduledRunnable) {
  runnable.run();
 }
 Assert.assertTrue(segmentsAnnouncedByMe.contains(segment));
 Assert.assertFalse("segment files shouldn't be deleted", segmentLoader.getSegmentsInTrash().contains(segment));
 segmentLoadDropHandler.stop();
}

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

/**
 * Steps:
 * 1. removeSegment() schedules a delete runnable that deletes segment files,
 * 2. addSegment() succesfully loads the segment and annouces it
 * 3. scheduled delete task executes and realizes it should not delete the segment files.
 */
@Test
public void testSegmentLoading1() throws Exception
{
 segmentLoadDropHandler.start();
 final DataSegment segment = makeSegment("test", "1", Intervals.of("P1d/2011-04-01"));
 segmentLoadDropHandler.removeSegment(segment, DataSegmentChangeCallback.NOOP);
 Assert.assertFalse(segmentsAnnouncedByMe.contains(segment));
 segmentLoadDropHandler.addSegment(segment, DataSegmentChangeCallback.NOOP);
 /*
   make sure the scheduled runnable that "deletes" segment files has been executed.
   Because another addSegment() call is executed, which removes the segment from segmentsToDelete field in
   ZkCoordinator, the scheduled runnable will not actually delete segment files.
  */
 for (Runnable runnable : scheduledRunnable) {
  runnable.run();
 }
 Assert.assertTrue(segmentsAnnouncedByMe.contains(segment));
 Assert.assertFalse("segment files shouldn't be deleted", segmentLoader.getSegmentsInTrash().contains(segment));
 segmentLoadDropHandler.stop();
}

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

if (segmentsToDelete.contains(segment)) {

代码示例来源:origin: de.dentrassi.eclipse.neoscada.utils/org.eclipse.scada.utils

@Override
public boolean contains ( final Object o )
{
  return this.internalSet.contains ( o );
}

代码示例来源:origin: org.ballerinalang/ballerina-core

public void notifyLocalParticipantFailure(String gTransactionId, String blockId) {
    ConcurrentSkipListSet<String> participantBlockIds = localParticipants.get(gTransactionId);
    if (participantBlockIds != null && participantBlockIds.contains(blockId)) {
      failedLocalParticipantSet.add(gTransactionId);
    }
  }
}

代码示例来源:origin: org.apache.pulsar/pulsar-client-original

/**
 * Since the ack are delayed, we need to do some best-effort duplicate check to discard messages that are being
 * resent after a disconnection and for which the user has already sent an acknowlowdgement.
 */
public boolean isDuplicate(MessageId messageId) {
  if (messageId.compareTo(lastCumulativeAck) <= 0) {
    // Already included in a cumulative ack
    return true;
  } else {
    return pendingIndividualAcks.contains(messageId);
  }
}

代码示例来源:origin: com.orientechnologies/orientdb-core

public OLogSequenceNumber begin(final long segmentId) {
 if (segments.contains(segmentId)) {
  return new OLogSequenceNumber(segmentId, OCASWALPage.RECORDS_OFFSET);
 }
 return null;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.utils/org.eclipse.scada.utils

@Override
public boolean add ( final E e )
{
  final boolean result = this.internalSet.add ( e );
  if ( !result )
  {
    return false;
  }
  shrinkToSize ();
  return this.internalSet.contains ( e );
}

代码示例来源:origin: org.wildfly/wildfly-naming

public void add(final ServiceName serviceName) {
  final ConcurrentSkipListSet<ServiceName> boundServices = this.boundServices;
  if (boundServices.contains(serviceName)) {
    throw NamingLogger.ROOT_LOGGER.serviceAlreadyBound(serviceName);
  }
  boundServices.add(serviceName);
}

代码示例来源:origin: org.apache.storm/storm-core

public void cleanPipeline(Channel channel) {
  boolean authenticated = authenticated_channels.contains(channel);
  if(!authenticated) {
    if(channel.getPipeline().get(ThriftNettyServerCodec.SASL_HANDLER) != null) {
      channel.getPipeline().remove(ThriftNettyServerCodec.SASL_HANDLER);
    }
    else if(channel.getPipeline().get(ThriftNettyServerCodec.KERBEROS_HANDLER) != null) {
      channel.getPipeline().remove(ThriftNettyServerCodec.KERBEROS_HANDLER);
    }
  }
}

相关文章

微信公众号

最新文章

更多