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

com.github.dm.jrt.channel.StreamingChannel Maven / Gradle / Ivy

There is a newer version: 5.9.0
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 com.github.dm.jrt.channel;

import com.github.dm.jrt.util.TimeDuration;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.concurrent.TimeUnit;

/**
 * Interface defining a streaming channel, that is, an I/O channel in which data are processed by
 * one or more routine invocations.
 * 

* This type of channel is mainly meant to act as a processing pipeline in which each input produces * one or more results.
* Streaming channels can be concatenated to form a new channel, or used as inputs for other * channels or routine invocations.
* Note that a streaming channel must always be closed in order to correctly terminate the lifecycle * of the involved invocations. *

* Created by davide-maestroni on 09/24/2015. * * @param the input data type. * @param the output data type. */ public interface StreamingChannel extends IOChannel { /** * {@inheritDoc} */ @NotNull StreamingChannel after(@NotNull TimeDuration delay); /** * {@inheritDoc} */ @NotNull StreamingChannel after(long delay, @NotNull TimeUnit timeUnit); /** * {@inheritDoc} */ @NotNull StreamingChannel now(); /** * {@inheritDoc} */ @NotNull StreamingChannel orderByCall(); /** * {@inheritDoc} */ @NotNull StreamingChannel orderByChance(); /** * {@inheritDoc} */ @NotNull StreamingChannel orderByDelay(); /** * {@inheritDoc} */ @NotNull StreamingChannel pass(@Nullable OutputChannel channel); /** * {@inheritDoc} */ @NotNull StreamingChannel pass(@Nullable Iterable inputs); /** * {@inheritDoc} */ @NotNull StreamingChannel pass(@Nullable IN input); /** * {@inheritDoc} */ @NotNull StreamingChannel pass(@Nullable IN... inputs); /** * {@inheritDoc} */ @NotNull StreamingChannel afterMax(@NotNull TimeDuration timeout); /** * {@inheritDoc} */ @NotNull StreamingChannel afterMax(long timeout, @NotNull TimeUnit timeUnit); /** * {@inheritDoc} */ @NotNull StreamingChannel allInto(@NotNull Collection results); /** * {@inheritDoc} */ @NotNull StreamingChannel eventuallyAbort(); /** * {@inheritDoc} */ @NotNull StreamingChannel eventuallyExit(); /** * {@inheritDoc} */ @NotNull StreamingChannel eventuallyThrow(); /** * {@inheritDoc} */ @NotNull StreamingChannel immediately(); /** * {@inheritDoc} */ @NotNull StreamingChannel passTo(@NotNull OutputConsumer consumer); /** * {@inheritDoc} */ @NotNull StreamingChannel skip(int count); /** * {@inheritDoc} */ @NotNull StreamingChannel close(); /** * Creates a new streaming channel which is the concatenation of the specified channel and this * one. *

* Note that this channel will be closed as a result of the call. * * @param channel the channel after which to concatenate this one. * @param the concatenation input type. * @return the concatenated channel. */ @NotNull StreamingChannel combine( @NotNull IOChannel channel); /** * Creates a new streaming channel which is the concatenation of this channel and the specified * one. *

* Note that the passed channel will be closed as a result of the call. * * @param channel the channel to concatenate after this one. * @param the concatenation output type. * @return the concatenated channel. */ @NotNull StreamingChannel concat(@NotNull IOChannel channel); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy