Class OperationSubmitter


  • @Incubating
    public abstract class OperationSubmitter
    extends Object
    Interface defining how operation should be submitted to the queue or executor.

    WARNING: while this type is API, because instances should be manipulated by users, all of its methods are considered SPIs and therefore should never be called directly by users. In short, users are only expected to get instances of this type from an API and pass it to another API.

    Currently supported implementations:

    • Method Detail

      • blocking

        public static OperationSubmitter blocking()
        When using this submitter, dding a new element will block the thread when the underlying queue is a BlockingQueue and it is at its maximum capacity, until some elements are removed from the queue
      • offloading

        public static OperationSubmitter offloading​(Consumer<Runnable> executor)
        Creates an operation submitter that would attempt to submit work to a queue, but in case the queue is full it would offload the submitting of the operation to provided executor. This would never block the current thread, but the one to which the work is offloaded.
        Parameters:
        executor - executor to offload submit operation to if the queue is full