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

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

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

ConcurrentSkipListSet.last介绍

暂无

代码示例

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

/**
 * Remove the contiguous seen msgIds from the nonContiguousMsgIds and update highestContiguousMsgId
 */
private void reconcile() {
 // If nonContiguousMsgIds is empty then nothing to reconcile.
 if (nonContiguousMsgIds.isEmpty()) {
  return;
 }
 // This happens when a passive is started after Active has moved on and
 // passive starts to see msgIDs starting from a number > 0.
 // Once the sync is completed, fast forward highestContiguousMsgId.
 // Post sync completion assuming platform will send all msgIds beyond highestContiguousMsgId.
 if (highestContiguousMsgId == -1L && isSyncCompleted) {
  Long min = nonContiguousMsgIds.last();
  LOGGER.info("Setting highestContiguousMsgId to {} from -1", min);
  highestContiguousMsgId = min;
  nonContiguousMsgIds.removeIf(msgId -> msgId <= min);
 }
 for (long msgId : nonContiguousMsgIds) {
  if (msgId <= highestContiguousMsgId) {
   nonContiguousMsgIds.remove(msgId);
  } else if (msgId > highestContiguousMsgId + 1) {
   break;
  } else {
   // the order is important..
   highestContiguousMsgId = msgId;
   nonContiguousMsgIds.remove(msgId);
  }
 }
}

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

@Override
public E last ()
{
  return this.internalSet.last ();
}

代码示例来源:origin: org.everit.cluster/org.everit.cluster.invalidationmap.support

/**
 * Notifies the registry about a ping message. Also checks whether the node has out of order
 * messages.
 *
 * @param nodeName
 *          Name of the node.
 * @param messageNumber
 *          Message number.
 * @return <code>true</code> if message numbers are in order or node not exists.
 */
public boolean ping(final String nodeName, final long messageNumber) {
 NodeState state = nodeState.get(nodeName);
 // message numbers are in order if
 // the current message number is the expected (last=current)
 // or an older, out of order ping message was got (last>current)
 return state == null || state.gotMessageNumbers.last() >= messageNumber;
}

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

@Override
public Event getDependencyEvent(DependencyContext dc) {
  ConcurrentSkipListSet<Event> events = m_dependencyEvents.get(dc);
  return events.size() > 0 ? events.last() : null;
}

代码示例来源:origin: io.snappydata/gemfire-core

Hoplog getOldestHoplog() {
 if (hoplogs.isEmpty()) {
  return null;
 }
 return hoplogs.last().get();
}

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

Hoplog getOldestHoplog() {
 if (hoplogs.isEmpty()) {
  return null;
 }
 return hoplogs.last().get();
}

代码示例来源:origin: org.everit.cluster/org.everit.cluster.invalidationmap.support

/**
 * Notifies the registry about a non-ping message. Also checks whether the node has out of order
 * messages.
 *
 * @param nodeName
 *          Name of the node.
 * @param messageNumber
 *          Message number.
 * @return <code>true</code> if message numbers are in order or node not exists.
 */
public boolean receive(final String nodeName, final long messageNumber) {
 NodeState state = nodeState.get(nodeName);
 if (state == null) {
  return true;
 }
 long last;
 synchronized (state) {
  // save the number of the last message, and register the number of the current message
  last = state.gotMessageNumbers.last();
  state.gotMessageNumbers.add(Long.valueOf(messageNumber));
 }
 if (state.gotMessageNumbers.size() > MESSAGE_NUMBER_MAINTENANCE_THRESHOLD) {
  state.maintainGotMessageNumbers();
 }
 // message numbers are in order if
 // the received message is the next expected message (last+1=current) and
 // or an older, out of order message (last+1>current)
 return last + 1 >= messageNumber;
}

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

memberOwnedCacheEntries.last(), member.getSocketAddress().getHostString());
partition.setConf(this.getConf());
partitions.add(partition);

代码示例来源:origin: org.apache.gora/gora-jcache

@Override
public List<PartitionQuery<K, T>> getPartitions(Query<K, T> query) throws IOException {
 List<PartitionQuery<K, T>> partitions = new ArrayList<>();
 try {
  Member[] clusterMembers = new Member[hazelcastInstance.getCluster().getMembers().size()];
  this.hazelcastInstance.getCluster().getMembers().toArray(clusterMembers);
  for (Member member : clusterMembers) {
   JCacheResult<K, T> result = ((JCacheResult<K, T>) query.execute());
   ConcurrentSkipListSet<K> memberOwnedCacheEntries = new ConcurrentSkipListSet<>();
   while (result.next()) {
    K key = result.getKey();
    Partition partition = hazelcastInstance.getPartitionService().getPartition(key);
    if (partition.getOwner().getUuid().equals(member.getUuid())) {
     memberOwnedCacheEntries.add(key);
    }
   }
   PartitionQueryImpl<K, T> partition = new PartitionQueryImpl<>(
       query, memberOwnedCacheEntries.first(),
       memberOwnedCacheEntries.last(), member.getSocketAddress().getHostString());
   partition.setConf(this.getConf());
   partitions.add(partition);
  }
 } catch (java.lang.Exception ex) {
  LOG.error("Exception occurred while partitioning the query based on Hazelcast partitions.", ex);
  return null;
 }
 LOG.info("Query is partitioned to {} number of partitions.", partitions.size());
 return partitions;
}

代码示例来源:origin: org.apache.gora/gora-jcache

@Override
public Result<K, T> execute(Query<K, T> query) {
 K startKey = query.getStartKey();
 K endKey = query.getEndKey();
 if (startKey == null) {
  if (!cacheEntryList.isEmpty()) {
   startKey = (K) cacheEntryList.first();
  }
 }
 if (endKey == null) {
  if (!cacheEntryList.isEmpty()) {
   endKey = (K) cacheEntryList.last();
  }
 }
 query.setFields(getFieldsToQuery(query.getFields()));
 ConcurrentSkipListSet<K> cacheEntrySubList = null;
 try {
  cacheEntrySubList = (ConcurrentSkipListSet<K>) cacheEntryList.subSet(startKey, true, endKey, true);
 } catch (NullPointerException npe) {
  LOG.error("NPE occurred while executing the query for JCacheStore. Hence returning empty entry set.", npe);
  return new JCacheResult<>(this, query, new ConcurrentSkipListSet<K>());
 }
 return new JCacheResult<>(this, query, cacheEntrySubList);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

public KeyRangeIterator(ConcurrentSkipListSet<DecoratedKey> keys)
{
  super((Long) keys.first().getToken().getTokenValue(), (Long) keys.last().getToken().getTokenValue(), keys.size());
  this.iterator = new DKIterator(keys.iterator());
}

代码示例来源:origin: jsevellec/cassandra-unit

public KeyRangeIterator(ConcurrentSkipListSet<DecoratedKey> keys)
{
  super((Long) keys.first().getToken().getTokenValue(), (Long) keys.last().getToken().getTokenValue(), keys.size());
  this.iterator = new DKIterator(keys.iterator());
}

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

public KeyRangeIterator(ConcurrentSkipListSet<DecoratedKey> keys)
{
  super((Long) keys.first().getToken().getTokenValue(), (Long) keys.last().getToken().getTokenValue(), keys.size());
  this.iterator = new DKIterator(keys.iterator());
}

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

nextSegmentId = 1;
} else {
 nextSegmentId = segments.last() + 1;

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

@Override
public Result<K, T> execute(Query<K, T> query) throws GoraException {
 K startKey = query.getStartKey();
 K endKey = query.getEndKey();
 if (startKey == null) {
  if (!cacheEntryList.isEmpty()) {
   startKey = (K) cacheEntryList.first();
  }
 }
 if (endKey == null) {
  if (!cacheEntryList.isEmpty()) {
   endKey = (K) cacheEntryList.last();
  }
 }
 query.setFields(getFieldsToQuery(query.getFields()));
 
 NavigableSet<K> cacheEntrySubList = null;
 if (startKey != null && endKey != null) {
  try {
   cacheEntrySubList =  cacheEntryList.subSet(startKey, true, endKey, true);
  } catch (Exception e) {
   throw new GoraException(e);
  }
 } else {
  // Empty
  cacheEntrySubList = Collections.emptyNavigableSet() ;
 }
 
 return new JCacheResult<>(this, query, cacheEntrySubList);
}

相关文章

微信公众号

最新文章

更多