< prev index next >
src/java.net.http/share/classes/jdk/internal/net/http/Http1AsyncReceiver.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 21,31 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package jdk.incubator.http;
import java.io.EOFException;
import java.io.IOException;
import java.lang.System.Logger.Level;
import java.nio.ByteBuffer;
--- 21,31 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package jdk.internal.net.http;
import java.io.EOFException;
import java.io.IOException;
import java.lang.System.Logger.Level;
import java.nio.ByteBuffer;
*** 38,52 ****
import java.util.concurrent.Flow;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
! import jdk.incubator.http.internal.common.Demand;
! import jdk.incubator.http.internal.common.FlowTube.TubeSubscriber;
! import jdk.incubator.http.internal.common.SequentialScheduler;
! import jdk.incubator.http.internal.common.ConnectionExpiredException;
! import jdk.incubator.http.internal.common.Utils;
/**
* A helper class that will queue up incoming data until the receiving
* side is ready to handle it.
--- 38,52 ----
import java.util.concurrent.Flow;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
! import jdk.internal.net.http.common.Demand;
! import jdk.internal.net.http.common.FlowTube.TubeSubscriber;
! import jdk.internal.net.http.common.SequentialScheduler;
! import jdk.internal.net.http.common.ConnectionExpiredException;
! import jdk.internal.net.http.common.Utils;
/**
* A helper class that will queue up incoming data until the receiving
* side is ready to handle it.
*** 362,372 ****
"Subscribed pending " + delegate + " queue.isEmpty: "
+ queue.isEmpty());
// Everything may have been received already. Make sure
// we parse it.
if (client.isSelectorThread()) {
! scheduler.deferOrSchedule(executor);
} else {
scheduler.runOrSchedule();
}
}
--- 362,372 ----
"Subscribed pending " + delegate + " queue.isEmpty: "
+ queue.isEmpty());
// Everything may have been received already. Make sure
// we parse it.
if (client.isSelectorThread()) {
! scheduler.runOrSchedule(executor);
} else {
scheduler.runOrSchedule();
}
}
*** 391,401 ****
queue.offer(buf);
// This callback is called from within the selector thread.
// Use an executor here to avoid doing the heavy lifting in the
// selector.
! scheduler.deferOrSchedule(executor);
}
// Callback: Consumer of Throwable
void onReadError(Throwable ex) {
Http1AsyncDelegate delegate;
--- 391,401 ----
queue.offer(buf);
// This callback is called from within the selector thread.
// Use an executor here to avoid doing the heavy lifting in the
// selector.
! scheduler.runOrSchedule(executor);
}
// Callback: Consumer of Throwable
void onReadError(Throwable ex) {
Http1AsyncDelegate delegate;
*** 432,442 ****
}
if (queue.isEmpty() || pendingDelegateRef.get() != null) {
// This callback is called from within the selector thread.
// Use an executor here to avoid doing the heavy lifting in the
// selector.
! scheduler.deferOrSchedule(executor);
}
}
void stop() {
debug.log(Level.DEBUG, "stopping");
--- 432,442 ----
}
if (queue.isEmpty() || pendingDelegateRef.get() != null) {
// This callback is called from within the selector thread.
// Use an executor here to avoid doing the heavy lifting in the
// selector.
! scheduler.runOrSchedule(executor);
}
}
void stop() {
debug.log(Level.DEBUG, "stopping");
*** 468,478 ****
assert this.subscription == null || dropped == false;
this.subscription = subscription;
dropped = false;
canRequestMore.set(true);
if (delegate != null) {
! scheduler.deferOrSchedule(executor);
}
}
void requestMore() {
Flow.Subscription s = subscription;
--- 468,478 ----
assert this.subscription == null || dropped == false;
this.subscription = subscription;
dropped = false;
canRequestMore.set(true);
if (delegate != null) {
! scheduler.runOrSchedule(executor);
}
}
void requestMore() {
Flow.Subscription s = subscription;
< prev index next >