Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datastax.dse.driver.internal.core.cql.reactive;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.reactivestreams.Processor;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* A simple {@link Processor} that receives items form an upstream publisher, stores them in an
* internal queue, then serves them to one single downstream subscriber. It does not support
* multiple subscriptions.
*
*
Implementation note: this class is intended to serve as the common implementation for all
* secondary publishers exposed by the driver's reactive API, and in particular, for publishers of
* query metadata objects. Since such publishers are not critical, and usually only publish a
* handful of items, this implementation favors simplicity over efficiency (in particular, it uses
* an unbounded linked queue, but in practice there is no risk that this queue could grow
* uncontrollably).
*
* @param The type of elements received and emitted by this processor.
*/
public class SimpleUnicastProcessor
implements Processor, Subscription {
private static final Logger LOG = LoggerFactory.getLogger(SimpleUnicastProcessor.class);
private static final Object ON_COMPLETE = new Object();
private final Queue