src/java.net.http/share/classes/jdk/internal/net/http/common/SSLTube.java
branchhttp-client-branch
changeset 56474 fe2bf7b369b8
parent 56451 9585061fdb04
child 56507 2294c51eae30
equal deleted inserted replaced
56463:b583caf69b39 56474:fe2bf7b369b8
    75     private final SSLFlowDelegate sslDelegate;
    75     private final SSLFlowDelegate sslDelegate;
    76     private final SSLEngine engine;
    76     private final SSLEngine engine;
    77     private volatile boolean finished;
    77     private volatile boolean finished;
    78 
    78 
    79     public SSLTube(SSLEngine engine, Executor executor, FlowTube tube) {
    79     public SSLTube(SSLEngine engine, Executor executor, FlowTube tube) {
       
    80         this(engine, executor, null, tube);
       
    81     }
       
    82 
       
    83     public SSLTube(SSLEngine engine,
       
    84                    Executor executor,
       
    85                    Consumer<ByteBuffer> recycler,
       
    86                    FlowTube tube) {
    80         Objects.requireNonNull(engine);
    87         Objects.requireNonNull(engine);
    81         Objects.requireNonNull(executor);
    88         Objects.requireNonNull(executor);
    82         this.tube = Objects.requireNonNull(tube);
    89         this.tube = Objects.requireNonNull(tube);
    83         writeSubscription = new SSLSubscriptionWrapper();
    90         writeSubscription = new SSLSubscriptionWrapper();
    84         readSubscriber = new SSLSubscriberWrapper();
    91         readSubscriber = new SSLSubscriberWrapper();
    85         this.engine = engine;
    92         this.engine = engine;
    86         sslDelegate = new SSLTubeFlowDelegate(engine,
    93         sslDelegate = new SSLTubeFlowDelegate(engine,
    87                                               executor,
    94                                               executor,
       
    95                                               recycler,
    88                                               readSubscriber,
    96                                               readSubscriber,
    89                                               tube);
    97                                               tube);
    90     }
    98     }
    91 
    99 
    92     final class SSLTubeFlowDelegate extends SSLFlowDelegate {
   100     final class SSLTubeFlowDelegate extends SSLFlowDelegate {
    93         SSLTubeFlowDelegate(SSLEngine engine, Executor executor,
   101         SSLTubeFlowDelegate(SSLEngine engine, Executor executor,
       
   102                             Consumer<ByteBuffer> recycler,
    94                             SSLSubscriberWrapper readSubscriber,
   103                             SSLSubscriberWrapper readSubscriber,
    95                             FlowTube tube) {
   104                             FlowTube tube) {
    96             super(engine, executor, readSubscriber, tube);
   105             super(engine, executor, recycler, readSubscriber, tube);
    97         }
   106         }
    98         protected SchedulingAction enterReadScheduling() {
   107         protected SchedulingAction enterReadScheduling() {
    99             readSubscriber.processPendingSubscriber();
   108             readSubscriber.processPendingSubscriber();
   100             return SchedulingAction.CONTINUE;
   109             return SchedulingAction.CONTINUE;
   101         }
   110         }