src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/PushGroup.java
author chegar
Mon, 05 Feb 2018 11:54:03 +0000
branchhttp-client-branch
changeset 56062 48afabd2de78
parent 56020 ae3a51bc5b9f
permissions -rw-r--r--
http-client-branch: inconsistent synchronization of PushGroup
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     1
/*
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     4
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    10
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    15
 * accompanied this code).
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    16
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    20
 *
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    23
 * questions.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    24
 */
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    25
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    26
package jdk.incubator.http;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    27
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    28
import java.security.AccessControlContext;
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    29
import java.security.AccessController;
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    30
import java.util.Objects;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    31
import java.util.concurrent.CompletableFuture;
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    32
import jdk.incubator.http.HttpResponse.BodyHandler;
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    33
import jdk.incubator.http.HttpResponse.PushPromiseHandler;
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    34
import jdk.incubator.http.HttpResponse.UntrustedBodyHandler;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    35
import jdk.incubator.http.internal.common.MinimalFuture;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    36
import jdk.incubator.http.internal.common.Log;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    37
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    38
/**
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    39
 * One PushGroup object is associated with the parent Stream of the pushed
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    40
 * Streams. This keeps track of all common state associated with the pushes.
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    41
 */
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    42
class PushGroup<T> {
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    43
    private final HttpRequest initiatingRequest;
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    44
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    45
    final CompletableFuture<Void> noMorePushesCF;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    46
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    47
    volatile Throwable error; // any exception that occurred during pushes
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    48
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    49
    // user's subscriber object
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    50
    final PushPromiseHandler<T> pushPromiseHandler;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    51
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    52
    private final AccessControlContext acc;
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    53
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    54
    int numberOfPushes;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    55
    int remainingPushes;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    56
    boolean noMorePushes = false;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    57
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    58
    PushGroup(PushPromiseHandler<T> pushPromiseHandler,
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    59
              HttpRequestImpl initiatingRequest,
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    60
              AccessControlContext acc) {
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    61
        this(pushPromiseHandler, initiatingRequest, new MinimalFuture<>(), acc);
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    62
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    63
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    64
    // Check mainBodyHandler before calling nested constructor.
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    65
    private PushGroup(HttpResponse.PushPromiseHandler<T> pushPromiseHandler,
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    66
                      HttpRequestImpl initiatingRequest,
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    67
                      CompletableFuture<HttpResponse<T>> mainResponse,
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    68
                      AccessControlContext acc) {
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    69
        this.noMorePushesCF = new MinimalFuture<>();
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    70
        this.pushPromiseHandler = pushPromiseHandler;
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    71
        this.initiatingRequest = initiatingRequest;
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    72
        // Restricts the file publisher with the senders ACC, if any
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    73
        if (pushPromiseHandler instanceof UntrustedBodyHandler)
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    74
            ((UntrustedBodyHandler)this.pushPromiseHandler).setAccessControlContext(acc);
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
    75
        this.acc = acc;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    76
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    77
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    78
    interface Acceptor<T> {
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    79
        BodyHandler<T> bodyHandler();
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    80
        CompletableFuture<HttpResponse<T>> cf();
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    81
        boolean accepted();
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    82
    }
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    83
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    84
    private static class AcceptorImpl<T> implements Acceptor<T> {
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    85
        private volatile HttpResponse.BodyHandler<T> bodyHandler;
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    86
        private volatile CompletableFuture<HttpResponse<T>> cf;
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
    87
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    88
        CompletableFuture<HttpResponse<T>> accept(BodyHandler<T> bodyHandler) {
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    89
            Objects.requireNonNull(bodyHandler);
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    90
            if (this.bodyHandler != null)
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    91
                throw new IllegalStateException("non-null bodyHandler");
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    92
            this.bodyHandler = bodyHandler;
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    93
            cf = new MinimalFuture<>();
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    94
            return cf;
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    95
        }
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    96
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    97
        @Override public BodyHandler<T> bodyHandler() { return bodyHandler; }
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
    98
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
    99
        @Override public CompletableFuture<HttpResponse<T>> cf() { return cf; }
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
   100
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
   101
        @Override public boolean accepted() { return cf != null; }
48083
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
   102
    }
b1c1b4ef4be2 8191494: Refresh incubating HTTP Client
chegar
parents: 47216
diff changeset
   103
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
   104
    Acceptor<T> acceptPushRequest(HttpRequest pushRequest) {
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
   105
        AcceptorImpl<T> acceptor = new AcceptorImpl<>();
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
   106
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
   107
        pushPromiseHandler.applyPushPromise(initiatingRequest, pushRequest, acceptor::accept);
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   108
56062
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   109
        synchronized (this) {
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   110
            if (acceptor.accepted()) {
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   111
                if (acceptor.bodyHandler instanceof UntrustedBodyHandler) {
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   112
                    ((UntrustedBodyHandler) acceptor.bodyHandler).setAccessControlContext(acc);
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   113
                }
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   114
                numberOfPushes++;
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   115
                remainingPushes++;
56020
ae3a51bc5b9f http-client-branch: fix acc in PushGroup
chegar
parents: 56010
diff changeset
   116
            }
56062
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   117
            return acceptor;
56010
782b2f2d1e76 http-client-branch: updated server push API
michaelm
parents: 55973
diff changeset
   118
        }
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   119
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   120
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   121
    // This is called when the main body response completes because it means
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   122
    // no more PUSH_PROMISEs are possible
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   123
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   124
    synchronized void noMorePushes(boolean noMore) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   125
        noMorePushes = noMore;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   126
        checkIfCompleted();
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   127
        noMorePushesCF.complete(null);
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   128
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   129
56062
48afabd2de78 http-client-branch: inconsistent synchronization of PushGroup
chegar
parents: 56020
diff changeset
   130
    synchronized CompletableFuture<Void> pushesCF() {
42460
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   131
        return noMorePushesCF;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   132
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   133
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   134
    synchronized boolean noMorePushes() {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   135
        return noMorePushes;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   136
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   137
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   138
    synchronized void pushCompleted() {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   139
        remainingPushes--;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   140
        checkIfCompleted();
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   141
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   142
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   143
    synchronized void checkIfCompleted() {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   144
        if (Log.trace()) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   145
            Log.logTrace("PushGroup remainingPushes={0} error={1} noMorePushes={2}",
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   146
                         remainingPushes,
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   147
                         (error==null)?error:error.getClass().getSimpleName(),
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   148
                         noMorePushes);
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   149
        }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   150
        if (remainingPushes == 0 && error == null && noMorePushes) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   151
            if (Log.trace()) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   152
                Log.logTrace("push completed");
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   153
            }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   154
        }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   155
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   156
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   157
    synchronized void pushError(Throwable t) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   158
        if (t == null) {
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   159
            return;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   160
        }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   161
        this.error = t;
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   162
    }
7133f144981a 8170648: Move java.net.http package out of Java SE to incubator namespace
michaelm
parents:
diff changeset
   163
}