Top Description Inners Methods
jdk.internal.net.http.common

public Interface FlowTube

extends Flow.Publisher<List<ByteBuffer>>, Flow.Subscriber<List<ByteBuffer>>
Known Direct Implementers
jdk.internal.net.http.common.SSLTube, jdk.internal.net.http.SocketTube
Imports
java.nio.ByteBuffer, java.util.List, java.util.concurrent.Flow

FlowTube is an I/O abstraction that allows reading from and writing to a destination asynchronously. This is not a Flow.Processor<List<ByteBuffer>, List<ByteBuffer>>, but rather models a publisher source and a subscriber sink in a bidirectional flow.

The connectFlows method should be called to connect the bidirectional flow. A FlowTube supports handing over the same read subscription to different sequential read subscribers over time. When connectFlows(writePublisher, readSubscriber is called, the FlowTube will call dropSubscription on its former readSubscriber, and onSubscribe on its new readSubscriber.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
FlowTube.AbstractTubePublisher

Convenience abstract class for TubePublisher implementations.

public abstract static class
FlowTube.AbstractTubeSubscriber

Convenience abstract class for TubeSubscriber implementations.

public static interface
FlowTube.TubePublisher

A publisher for writing to the bidirectional flow.

public static interface
FlowTube.TubeSubscriber

A subscriber for reading from the bidirectional flow.

Method Summary

Modifier and TypeMethod and Description
public static FlowTube.TubePublisher

Returns:

a TubePublisher: either s if s is a TubePublisher, otherwise a TubePublisher wrapper that delegates to s
asTubePublisher
(Flow.Publisher<List<ByteBuffer>>
a publisher for writing.
p
)

Returns s if s is a TubePublisher, otherwise wraps it in a TubePublisher.

public static FlowTube.TubeSubscriber

Returns:

a TubeSubscriber: either s if s is a TubeSubscriber, otherwise a TubeSubscriber wrapper that delegates to s
asTubeSubscriber
(Flow.Subscriber<? super List<ByteBuffer>>
a subscriber for reading.
s
)

Returns s if s is a TubeSubscriber, otherwise wraps it in a TubeSubscriber.

public default void
connectFlows(FlowTube.TubePublisher
A new publisher for writing to the bidirectional flow.
writePublisher
,
FlowTube.TubeSubscriber
A new subscriber for reading from the bidirectional flow.
readSubscriber
)

Connects the bidirectional flows to a write Publisher and a read Subscriber.

public boolean

Returns:

true if the flow is finished
isFinished
()

Returns true if this flow was completed, either exceptionally or normally (EOF reached).

Inherited from java.util.concurrent.Flow.Publisher:
subscribe
Inherited from java.util.concurrent.Flow.Subscriber:
onCompleteonErroronNextonSubscribe

Method Detail

asTubePublisherback to summary
public static FlowTube.TubePublisher asTubePublisher(Flow.Publisher<List<ByteBuffer>> p)

Returns s if s is a TubePublisher, otherwise wraps it in a TubePublisher.

Parameters
p:Flow.Publisher<List<ByteBuffer>>

a publisher for writing.

Returns:FlowTube.TubePublisher

a TubePublisher: either s if s is a TubePublisher, otherwise a TubePublisher wrapper that delegates to s

asTubeSubscriberback to summary
public static FlowTube.TubeSubscriber asTubeSubscriber(Flow.Subscriber<? super List<ByteBuffer>> s)

Returns s if s is a TubeSubscriber, otherwise wraps it in a TubeSubscriber. Using the wrapper is only appropriate in the case where dropSubscription doesn't need to be implemented, and the TubeSubscriber is subscribed only once.

Parameters
s:Flow.Subscriber<? super List<ByteBuffer>>

a subscriber for reading.

Returns:FlowTube.TubeSubscriber

a TubeSubscriber: either s if s is a TubeSubscriber, otherwise a TubeSubscriber wrapper that delegates to s

connectFlowsback to summary
public default void connectFlows(FlowTube.TubePublisher writePublisher, FlowTube.TubeSubscriber readSubscriber)

Connects the bidirectional flows to a write Publisher and a read Subscriber. This method can be called sequentially several times to switch existing publishers and subscribers to a new pair of write subscriber and read publisher.

Parameters
writePublisher:FlowTube.TubePublisher

A new publisher for writing to the bidirectional flow.

readSubscriber:FlowTube.TubeSubscriber

A new subscriber for reading from the bidirectional flow.

isFinishedback to summary
public boolean isFinished()

Returns true if this flow was completed, either exceptionally or normally (EOF reached).

Returns:boolean

true if the flow is finished

jdk.internal.net.http.common back to summary

public abstract Class FlowTube.AbstractTubePublisher

extends Object
implements TubePublisher
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.common.FlowTube.TubePublisher, java.util.concurrent.Flow.Publisher
Known Direct Subclasses
jdk.internal.net.http.common.FlowTube.AbstractTubePublisher.TubePublisherWrapper

Convenience abstract class for TubePublisher implementations. It is not required that a TubePublisher implementation extends this class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractTubePublisherback to summary
public AbstractTubePublisher()
jdk.internal.net.http.common back to summary

pack-priv final Class FlowTube.AbstractTubePublisher.TubePublisherWrapper

extends AbstractTubePublisher
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Flow.Publisher<List<ByteBuffer>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
subscribe(Flow.Subscriber<? super List<ByteBuffer>>
the subscriber
subscriber
)

Implements java.util.concurrent.Flow.Publisher.subscribe.

Adds the given Subscriber if possible.

Field Detail

delegateback to summary
pack-priv final Flow.Publisher<List<ByteBuffer>> delegate

Constructor Detail

TubePublisherWrapperback to summary
public TubePublisherWrapper(Flow.Publisher<List<ByteBuffer>> delegate)

Method Detail

subscribeback to summary
public void subscribe(Flow.Subscriber<? super List<ByteBuffer>> subscriber)

Implements java.util.concurrent.Flow.Publisher.subscribe.

Doc from java.util.concurrent.Flow.Publisher.subscribe.

Adds the given Subscriber if possible. If already subscribed, or the attempt to subscribe fails due to policy violations or errors, the Subscriber's onError method is invoked with an IllegalStateException. Otherwise, the Subscriber's onSubscribe method is invoked with a new Subscription. Subscribers may enable receiving items by invoking the request method of this Subscription, and may unsubscribe by invoking its cancel method.

Parameters
subscriber:Flow.Subscriber<? super List<ByteBuffer>>

the subscriber

Annotations
@Override
jdk.internal.net.http.common back to summary

public abstract Class FlowTube.AbstractTubeSubscriber

extends Object
implements TubeSubscriber
Class Inheritance
All Implemented Interfaces
jdk.internal.net.http.common.FlowTube.TubeSubscriber, java.util.concurrent.Flow.Subscriber
Known Direct Subclasses
jdk.internal.net.http.common.FlowTube.AbstractTubeSubscriber.TubeSubscriberWrapper

Convenience abstract class for TubeSubscriber implementations. It is not required that a TubeSubscriber implementation extends this class.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractTubeSubscriberback to summary
public AbstractTubeSubscriber()
jdk.internal.net.http.common back to summary

pack-priv final Class FlowTube.AbstractTubeSubscriber.TubeSubscriberWrapper

extends AbstractTubeSubscriber
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Flow.Subscriber<? super List<ByteBuffer>>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
dropSubscription()

Overrides default jdk.internal.net.http.common.FlowTube.TubeSubscriber.dropSubscription.

Called when the flow is connected again, and the subscription is handed over to a new subscriber.

public void
onComplete()

Implements java.util.concurrent.Flow.Subscriber.onComplete.

Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription.

public void
onError(Throwable
the exception
throwable
)

Implements java.util.concurrent.Flow.Subscriber.onError.

Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription.

public void
onNext(List<ByteBuffer>
the item
item
)

Implements java.util.concurrent.Flow.Subscriber.onNext.

Method invoked with a Subscription's next item.

public void
onSubscribe(Flow.Subscription
a new subscription
subscription
)

Implements java.util.concurrent.Flow.Subscriber.onSubscribe.

Method invoked prior to invoking any other Subscriber methods for the given Subscription.

Field Detail

delegateback to summary
pack-priv final Flow.Subscriber<? super List<ByteBuffer>> delegate

Constructor Detail

TubeSubscriberWrapperback to summary
pack-priv TubeSubscriberWrapper(Flow.Subscriber<? super List<ByteBuffer>> delegate)

Method Detail

dropSubscriptionback to summary
public void dropSubscription()

Overrides default jdk.internal.net.http.common.FlowTube.TubeSubscriber.dropSubscription.

Doc from jdk.internal.net.http.common.FlowTube.TubeSubscriber.dropSubscription.

Called when the flow is connected again, and the subscription is handed over to a new subscriber. Once dropSubscription() is called, the TubeSubscriber should stop calling any method on its subscription.

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements java.util.concurrent.Flow.Subscriber.onComplete.

Doc from java.util.concurrent.Flow.Subscriber.onComplete.

Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription. If this method throws an exception, resulting behavior is undefined.

Annotations
@Override
onErrorback to summary
public void onError(Throwable throwable)

Implements java.util.concurrent.Flow.Subscriber.onError.

Doc from java.util.concurrent.Flow.Subscriber.onError.

Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription. If this method itself throws an exception, resulting behavior is undefined.

Parameters
throwable:Throwable

the exception

Annotations
@Override
onNextback to summary
public void onNext(List<ByteBuffer> item)

Implements java.util.concurrent.Flow.Subscriber.onNext.

Doc from java.util.concurrent.Flow.Subscriber.onNext.

Method invoked with a Subscription's next item. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription to be cancelled.

Parameters
item:List<ByteBuffer>

the item

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Flow.Subscription subscription)

Implements java.util.concurrent.Flow.Subscriber.onSubscribe.

Doc from java.util.concurrent.Flow.Subscriber.onSubscribe.

Method invoked prior to invoking any other Subscriber methods for the given Subscription. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription not to be established or to be cancelled.

Typically, implementations of this method invoke subscription.request to enable receiving items.

Parameters
subscription:Flow.Subscription

a new subscription

Annotations
@Override
jdk.internal.net.http.common back to summary

public Interface FlowTube.TubePublisher

extends Flow.Publisher<List<ByteBuffer>>
Known Direct Subinterfaces
jdk.internal.net.http.HttpConnection.HttpPublisher
Known Direct Implementers
jdk.internal.net.http.common.FlowTube.AbstractTubePublisher, jdk.internal.net.http.ConnectionPool.CleanupTrigger, jdk.internal.net.http.Http1Exchange.Http1Publisher, jdk.internal.net.http.RawChannelTube.WritePublisher

A publisher for writing to the bidirectional flow.

Method Summary

Inherited from java.util.concurrent.Flow.Publisher:
subscribe
jdk.internal.net.http.common back to summary

public Interface FlowTube.TubeSubscriber

extends Flow.Subscriber<List<ByteBuffer>>
Known Direct Implementers
jdk.internal.net.http.common.FlowTube.AbstractTubeSubscriber, jdk.internal.net.http.common.SSLFlowDelegate.Reader, jdk.internal.net.http.common.SSLTube.DelegateWrapper, jdk.internal.net.http.common.SSLTube.SSLSubscriberWrapper, jdk.internal.net.http.common.SubscriberWrapper, jdk.internal.net.http.Http1AsyncReceiver.Http1TubeSubscriber, jdk.internal.net.http.ConnectionPool.CleanupTrigger, jdk.internal.net.http.Http2Connection.Http2TubeSubscriber, jdk.internal.net.http.RawChannelTube.ReadSubscriber

A subscriber for reading from the bidirectional flow. A TubeSubscriber is a Flow.Subscriber that can be canceled by calling dropSubscription(). Once dropSubscription() is called, the TubeSubscriber should stop calling any method on its subscription.

Method Summary

Modifier and TypeMethod and Description
public default void
dropSubscription()

Called when the flow is connected again, and the subscription is handed over to a new subscriber.

public default boolean
Inherited from java.util.concurrent.Flow.Subscriber:
onCompleteonErroronNextonSubscribe

Method Detail

dropSubscriptionback to summary
public default void dropSubscription()

Called when the flow is connected again, and the subscription is handed over to a new subscriber. Once dropSubscription() is called, the TubeSubscriber should stop calling any method on its subscription.

supportsRecyclingback to summary
public default boolean supportsRecycling()