streak.FailStreamSource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of streak Show documentation
Show all versions of streak Show documentation
streak: Reactive Stream Experiments
The newest version!
package streak;
import java.util.Objects;
import javax.annotation.Nonnull;
final class FailStreamSource
extends Stream
{
@Nonnull
private final Throwable _error;
FailStreamSource( @Nonnull final Throwable error )
{
_error = Objects.requireNonNull( error );
}
@Override
protected void doSubscribe( @Nonnull final Subscriber super T> subscriber )
{
final WorkerSubscription subscription = new WorkerSubscription<>();
subscriber.onSubscribe( subscription );
subscriber.onError( _error );
subscription.cancel();
}
private static final class WorkerSubscription
implements Subscription
{
private WorkerSubscription()
{
}
/**
* {@inheritDoc}
*/
@Override
public void cancel()
{
}
}
}