All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.rsocket.internal.jctools.queues.MessagePassingQueue Maven / Gradle / Ivy

There is a newer version: 1.1.4
Show newest version
/*
 * Licensed 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 io.rsocket.internal.jctools.queues;

public interface MessagePassingQueue {
  int UNBOUNDED_CAPACITY = -1;

  interface Supplier {
    T get();
  }

  interface Consumer {
    void accept(T e);
  }

  interface WaitStrategy {
    int idle(int idleCounter);
  }

  interface ExitCondition {

    boolean keepRunning();
  }

  boolean offer(T e);

  T poll();

  T peek();

  int size();

  void clear();

  boolean isEmpty();

  int capacity();

  boolean relaxedOffer(T e);

  T relaxedPoll();

  T relaxedPeek();

  int drain(Consumer c);

  int fill(Supplier s);

  int drain(Consumer c, int limit);

  int fill(Supplier s, int limit);

  void drain(Consumer c, WaitStrategy wait, ExitCondition exit);

  void fill(Supplier s, WaitStrategy wait, ExitCondition exit);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy