private Invoker<T> selectForKey(long hash) { Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash); if (entry == null) { entry = virtualInvokers.firstEntry(); } return entry.getValue(); }
private Invoker<T> selectForKey(long hash) { Map.Entry<Long, Invoker<T>> entry = virtualInvokers.ceilingEntry(hash); if (entry == null) { entry = virtualInvokers.firstEntry(); } return entry.getValue(); }
TreeMap<String, String> myMap = new TreeMap<String, String>(); String first = myMap.firstEntry().getValue(); String firstOther = myMap.get(myMap.firstKey());
public int peekValue() { if (size == 0) { throw new IllegalStateException("collection is already empty!?"); } Entry<Integer, GHIntHashSet> e = map.firstEntry(); if (e.getValue().isEmpty()) { throw new IllegalStateException("internal set is already empty!?"); } return map.firstEntry().getKey(); }
protected Entry<Integer, ColumnFamilyHandle> getHandler(int timeoutSecond) { Entry<Integer, ColumnFamilyHandle> ceilingEntry = windowHandlers.ceilingEntry(timeoutSecond); if (ceilingEntry != null) { return ceilingEntry; } else { return windowHandlers.firstEntry(); } }
@Override public void put(String key, Object value) { put(key, value, windowHandlers.firstEntry()); }
@Override public void putBatch(Map<String, Object> map) { putBatch(map, windowHandlers.firstEntry()); }
/** * Select for key. * * @param hash the hash * @return the provider */ private ProviderInfo selectForKey(long hash) { Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash); if (entry == null) { entry = virtualNodes.firstEntry(); } return entry.getValue(); }
public long getActiveMinProcId() { Map.Entry<Long, BitSetNode> entry = map.firstEntry(); return entry == null ? Procedure.NO_PROC_ID : entry.getValue().getActiveMinProcId(); }
public float peekValue() { long key = map.firstEntry().getKey(); return Float.intBitsToFloat(bitUtil.getIntHigh(key)); }
public int peekKey() { long key = map.firstEntry().getKey(); return bitUtil.getIntLow(key); }
/** * Select for key. * * @param hash the hash * @return the provider */ private ProviderInfo selectForKey(long hash) { Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash); if (entry == null) { entry = virtualNodes.firstEntry(); } return entry.getValue(); }
/** * Select for key. * * @param hash the hash * @return the provider */ private ProviderInfo selectForKey(long hash) { Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash); if (entry == null) { entry = virtualNodes.firstEntry(); } return entry.getValue(); }
/** * Select for key. * * @param hash the hash * @return the provider */ private ProviderInfo selectForKey(long hash) { Map.Entry<Long, ProviderInfo> entry = virtualNodes.ceilingEntry(hash); if (entry == null) { entry = virtualNodes.firstEntry(); } return entry.getValue(); }
public String hashJob(int jobId, List<String> addressList) { // ------A1------A2-------A3------ // -----------J1------------------ TreeMap<Long, String> addressRing = new TreeMap<Long, String>(); for (String address: addressList) { for (int i = 0; i < VIRTUAL_NODE_NUM; i++) { long addressHash = hash("SHARD-" + address + "-NODE-" + i); addressRing.put(addressHash, address); } } long jobHash = hash(String.valueOf(jobId)); SortedMap<Long, String> lastRing = addressRing.tailMap(jobHash); if (!lastRing.isEmpty()) { return lastRing.get(lastRing.firstKey()); } return addressRing.firstEntry().getValue(); }
public int peekKey() { if (size == 0) { throw new IllegalStateException("collection is already empty!?"); } GHIntHashSet set = map.firstEntry().getValue(); if (set.isEmpty()) { throw new IllegalStateException("internal set is already empty!?"); } return set.iterator().next().value; }
@Override public void reportConsumerRunningInfo(TreeMap<String, ConsumerRunningInfo> criTable) { { boolean result = ConsumerRunningInfo.analyzeSubscription(criTable); if (!result) { log.info(String.format(LOG_NOTIFY + "reportConsumerRunningInfo: ConsumerGroup: %s, Subscription different", criTable .firstEntry().getValue().getProperties().getProperty("consumerGroup"))); } } { Iterator<Entry<String, ConsumerRunningInfo>> it = criTable.entrySet().iterator(); while (it.hasNext()) { Entry<String, ConsumerRunningInfo> next = it.next(); String result = ConsumerRunningInfo.analyzeProcessQueue(next.getKey(), next.getValue()); if (!result.isEmpty()) { log.info(String.format(LOG_NOTIFY + "reportConsumerRunningInfo: ConsumerGroup: %s, ClientId: %s, %s", criTable.firstEntry().getValue().getProperties().getProperty("consumerGroup"), next.getKey(), result)); } } } }
return; Entry<String, Type> first = fieldsMap.firstEntry(); String field = first.getKey(); Type type = first.getValue();
public static BaseDexFileReader open(byte[] data) throws IOException { if (data.length < 3) { throw new IOException("File too small to be a dex/zip"); } if ("dex".equals(new String(data, 0, 3, StandardCharsets.ISO_8859_1))) {// dex return new DexFileReader(data); } else if ("PK".equals(new String(data, 0, 2, StandardCharsets.ISO_8859_1))) {// ZIP TreeMap<String, DexFileReader> dexFileReaders = new TreeMap<>(); try (ZipFile zipFile = new ZipFile(data)) { for (ZipEntry e : zipFile.entries()) { String entryName = e.getName(); if (entryName.startsWith("classes") && entryName.endsWith(".dex")) { if (!dexFileReaders.containsKey(entryName)) { // only the first one dexFileReaders.put(entryName, new DexFileReader(toByteArray(zipFile.getInputStream(e)))); } } } } if (dexFileReaders.size() == 0) { throw new IOException("Can not find classes.dex in zip file"); } else if (dexFileReaders.size() == 1) { return dexFileReaders.firstEntry().getValue(); } else { return new MultiDexFileReader(dexFileReaders.values()); } } throw new IOException("the src file not a .dex or zip file"); }
@Override public synchronized void tick() { long timeMs = time.milliseconds(); while (true) { Map.Entry<Long, List<KafkaFutureImpl<Long>>> entry = waiters.firstEntry(); if ((entry == null) || (entry.getKey() > timeMs)) { break; } for (KafkaFutureImpl<Long> future : entry.getValue()) { future.complete(timeMs); } waiters.remove(entry.getKey()); } }