@Override public Object[] getRow() { Object[] retRow = buffer.pollFirst(); return retRow; }
/** * Removes and returns first element, or null if empty. * * @return The removed element. */ private E innerRemoveFirst() { E f = list.pollFirst(); if (f == null) return null; notFull.signal(); return f; }
public JobPo pollFirst() { lock.lock(); try { JobPo f = list.pollFirst(); if (f == null) return null; jobs.remove(f.getJobId()); return f; } finally { lock.unlock(); } }
public JobPo pollFirst() { lock.lock(); try { JobPo f = list.pollFirst(); if (f == null) return null; jobs.remove(f.getJobId()); return f; } finally { lock.unlock(); } }
/** {@inheritDoc} */ @Override public synchronized void evictDataPage() throws IgniteCheckedException { evictDataPage(pageUsageList.pollFirst()); }
private void emitNewRecord (SpoutOutputCollector collector) { for (Map.Entry<String, LinkedList<Record>> entry: toEmitPerShard.entrySet()) { String shardId = entry.getKey(); LinkedList<Record> listOfRecords = entry.getValue(); Record record; while ((record = listOfRecords.pollFirst()) != null) { KinesisMessageId kinesisMessageId = new KinesisMessageId(kinesisConfig.getStreamName(), shardId, record.getSequenceNumber()); if (emitRecord(collector, record, kinesisMessageId)) { return; } } } }
Object r = queue.pollFirst(); List<Object> childrens = getChildrens(w, r);
Long id = queue.pollFirst(); resourceGroupIdTemplateMap.computeIfAbsent(id, k -> { ResourceGroupSpecBuilder builder = recordMap.get(id);
private List<String> listPathsRecursive(FileSystem fs, Path path) throws IOException { List<String> paths = new ArrayList<>(); LinkedList<Path> queue = new LinkedList<>(); queue.add(path); while (!queue.isEmpty()) { Path next = queue.pollFirst(); FileStatus[] stats = fs.listStatus(next, AcidUtils.hiddenFileFilter); for (FileStatus stat : stats) { Path child = stat.getPath(); paths.add(child.toString()); if (stat.isDirectory()) { queue.add(child); } } } return paths; }
@SuppressWarnings("unchecked") private void nextNoCheck(Throwable t) { LOGGER.finest(() -> "(reqID: " + requestId() + ") Routing error: " + t.getClass()); for (ErrorHandlerRecord<?> record = errorHandlers.pollFirst(); record != null; record = errorHandlers.pollFirst()) { if (record.exceptionClass.isAssignableFrom(t.getClass())) { ErrorRoutedRequest nextErrorRequest = new ErrorRoutedRequest(errorHandlers, t); requestSpan.log(CollectionsHelper.mapOf("event", "error-handler", "handler.class", record.errorHandler.getClass().getName(), "handled.error.message", t.toString())); try { // there's no way to avoid this cast ((ErrorHandler<Throwable>) record.errorHandler).accept(nextErrorRequest, response, t); } catch (Throwable e) { // when an exception is thrown in an error handler, the original exception is only logged // the rest of the error handlers is skipped and the new exception is sent directly to the // default error handler. LOGGER.log(Level.WARNING, "Exception unexpectedly thrown from an error handler. Error handling of this logged " + "exception was aborted.", t); defaultHandler(new IllegalStateException("Unexpected exception encountered during error handling.", e)); return; } return; } } defaultHandler(t); }
elementCycleCount--; LocatableInputSplitWithCount split = splits.pollFirst(); if (unassignedSplits.contains(split)) { int localCount = split.getLocalCount();
LinkedList<Group> stack = new LinkedList<>(conf.groups); while (!stack.isEmpty()) { Group group = stack.pollFirst(); stack.addAll(group.getSubgroups());
/** * 返回lexeme * * 同时处理合并 * @return */ Lexeme getNextLexeme(){ //从结果集取出,并移除第一个Lexme Lexeme result = this.results.pollFirst(); while(result != null){ //数量词合并 this.compound(result); if(Dictionary.getSingleton().isStopWord(this.segmentBuff , result.getBegin() , result.getLength())){ //是停止词继续取列表的下一个 result = this.results.pollFirst(); }else{ //不是停止词, 生成lexeme的词元文本,输出 result.setLexemeText(String.valueOf(segmentBuff , result.getBegin() , result.getLength())); break; } } return result; }
while ((q = initQueries.peekFirst()) != null) { q.execute(); initQueries.pollFirst();
public EmitState emit(SpoutOutputCollector collector) { if (emittingMessages.isEmpty()) { fillMessages(); } int count = 0; while (true) { MessageAndOffset toEmitMsg = emittingMessages.pollFirst(); if (toEmitMsg == null) { return EmitState.EMIT_END; } count ++; Iterable<List<Object>> tups = generateTuples(toEmitMsg.message()); if (tups != null) { for (List<Object> tuple : tups) { LOG.debug("emit message {}", new String(Utils.toByteArray(toEmitMsg.message().payload()))); collector.emit(tuple, new KafkaMessageId(partition, toEmitMsg.offset())); } if(count>=config.batchSendCount) { break; } } else { ack(toEmitMsg.offset()); } } if (emittingMessages.isEmpty()) { return EmitState.EMIT_END; } else { return EmitState.EMIT_MORE; } }
GetRequest queueReq = pool.queue.pollFirst(); if (pool.metrics != null) { pool.metrics.moveQueuedToRunning();
public static void main(String[] args) throws IOException { OsmandRegions or = new OsmandRegions(); or.prepareFile("/Users/victorshcherb/osmand/repos/resources/countries-info/regions.ocbf"); LinkedList<WorldRegion> lst = new LinkedList<WorldRegion>(); lst.add(or.getWorldRegion()); // int i =0; while (!lst.isEmpty()) { WorldRegion wd = lst.pollFirst(); System.out.println((wd.superregion == null ? "" : wd.superregion.getLocaleName()) + " " + wd.getLocaleName() + " " + wd.getRegionDownloadName()); // if(i++ <=5) // lst.addAll(wd.getSubregions()); } or.cacheAllCountries(); // long t = System.currentTimeMillis(); // or.cacheAllCountries(); // System.out.println("Init " + (System.currentTimeMillis() - t)); //testCountry(or, 15.8, 23.09, "chad"); testCountry(or, 52.10, 4.92, "the netherlands", "utrecht"); testCountry(or, 52.15, 7.50, "north rhine-westphalia"); testCountry(or, 28.8056, 29.9858, "egypt"); // testCountry(or, 40.0760, 9.2807, "italy", "sardinia"); testCountry(or, 35.7521, 139.7887, "japan"); testCountry(or, 46.5145, 102.2580, "mongolia"); testCountry(or, 62.54, 43.36, "arkhangelsk oblast", "northwestern federal district"); }
CleanupRecord removedRecord = removedList.pollFirst(); if (removedRecord == null) { lastEnabledRecord = record;