Refine search
/** * Configure "streaming" media types for which flushing should be performed * automatically vs at the end of the stream. * <p>By default this is set to {@link MediaType#APPLICATION_STREAM_JSON}. * @param mediaTypes one or more media types to add to the list * @see HttpMessageEncoder#getStreamingMediaTypes() */ public void setStreamingMediaTypes(List<MediaType> mediaTypes) { this.streamingMediaTypes.clear(); this.streamingMediaTypes.addAll(mediaTypes); }
/** * Set the locale of the request, overriding any previous locales. * @param locale the locale, or {@code null} to reset it * @see #locale(Locale...) */ public MockHttpServletRequestBuilder locale(@Nullable Locale locale) { this.locales.clear(); if (locale != null) { this.locales.add(locale); } return this; }
/** * Remove all registered transformers, in inverse order of registration. */ public void removeTransformers() { synchronized (this.transformers) { if (this.instrumentation != null && !this.transformers.isEmpty()) { for (int i = this.transformers.size() - 1; i >= 0; i--) { this.instrumentation.removeTransformer(this.transformers.get(i)); } this.transformers.clear(); } } }
@Override protected void action() { MessageEnvelope msg; //Opportunistically drain the queue for up to the batch-send-size number of messages before evaluating condition while (toSend.size()<sendBatchSize && (msg=outgoingMsg.poll())!=null) { toSend.add(msg); } //Evaluate send condition: 1) Is the oldest message waiting longer than the delay? or 2) Do we have enough messages to send? if (!toSend.isEmpty() && (maxSendDelay.compareTo(timeSinceFirstMsg()) <= 0 || toSend.size() >= sendBatchSize)) { try { sendMessages(toSend); } finally { toSend.clear(); } } }
public void reset() { myRows.clear(); for (Map.Entry<KeyStroke, ShortcutOwner> entry : VimPlugin.getKey().getShortcutConflicts().entrySet()) { final KeyStroke keyStroke = entry.getKey(); final List<AnAction> actions = VimPlugin.getKey().getKeymapConflicts(keyStroke); if (!actions.isEmpty()) { myRows.add(new Row(keyStroke, actions.get(0), entry.getValue())); } } Collections.sort(myRows); }
/** * Drain all the calls from newCalls into pendingCalls. * * This function holds the lock for the minimum amount of time, to avoid blocking * users of AdminClient who will also take the lock to add new calls. */ private synchronized void drainNewCalls() { if (!newCalls.isEmpty()) { pendingCalls.addAll(newCalls); newCalls.clear(); } }
private static void insertAtStart(BlockNode block, List<InsnNode> insns) { List<InsnNode> blockInsns = block.getInstructions(); List<InsnNode> newInsnList = new ArrayList<>(insns.size() + blockInsns.size()); newInsnList.addAll(insns); newInsnList.addAll(blockInsns); blockInsns.clear(); blockInsns.addAll(newInsnList); }
public synchronized void setBucketPriorityList(@NonNull List<String> buckets) { List<String> previousBuckets = new ArrayList<>(bucketPriorityList); bucketPriorityList.clear(); bucketPriorityList.addAll(buckets); for (String previousBucket : previousBuckets) { if (!buckets.contains(previousBucket)) { // Keep any buckets from the previous list that aren't included here, but but them at the // end. bucketPriorityList.add(previousBucket); } } }
private void updateFilters() { if (this.filters.isEmpty()) { return; } List<WebFilter> filtersToUse = this.filters.stream() .peek(filter -> { if (filter instanceof ForwardedHeaderTransformer && this.forwardedHeaderTransformer == null) { this.forwardedHeaderTransformer = (ForwardedHeaderTransformer) filter; } }) .filter(filter -> !(filter instanceof ForwardedHeaderTransformer)) .collect(Collectors.toList()); this.filters.clear(); this.filters.addAll(filtersToUse); }
/** * @see java.io.ByteArrayOutputStream#reset() */ public synchronized void reset() { count = 0; filledBufferSum = 0; currentBufferIndex = 0; if (reuseBuffers) { currentBuffer = buffers.get(currentBufferIndex); } else { //Throw away old buffers currentBuffer = null; final int size = buffers.get(0).length; buffers.clear(); needNewBuffer(size); reuseBuffers = true; } }
@Override public ResponseSpec onStatus(Predicate<HttpStatus> statusPredicate, Function<ClientResponse, Mono<? extends Throwable>> exceptionFunction) { if (this.statusHandlers.size() == 1 && this.statusHandlers.get(0) == DEFAULT_STATUS_HANDLER) { this.statusHandlers.clear(); } this.statusHandlers.add(new StatusHandler(statusPredicate, (clientResponse, request) -> exceptionFunction.apply(clientResponse))); return this; }
/** * Remove all registered transformers, in inverse order of registration. */ public void removeTransformers() { synchronized (this.transformers) { if (this.instrumentation != null && !this.transformers.isEmpty()) { for (int i = this.transformers.size() - 1; i >= 0; i--) { this.instrumentation.removeTransformer(this.transformers.get(i)); } this.transformers.clear(); } } }