mirror of
https://github.com/square/okhttp.git
synced 2026-01-17 08:42:25 +03:00
Use ExecutorService.execute, not ExecutorService.submit.
The latter returns a Future that we never call get() on, and never get the exception from. Fixes: https://github.com/square/okhttp/issues/1294
This commit is contained in:
@@ -352,7 +352,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void writeWindowUpdateLater(final int streamId, final long unacknowledgedBytesRead) {
|
void writeWindowUpdateLater(final int streamId, final long unacknowledgedBytesRead) {
|
||||||
executor.submit(new NamedRunnable("OkHttp Window Update %s stream %d", hostName, streamId) {
|
executor.execute(new NamedRunnable("OkHttp Window Update %s stream %d", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
try {
|
try {
|
||||||
frameWriter.windowUpdate(streamId, unacknowledgedBytesRead);
|
frameWriter.windowUpdate(streamId, unacknowledgedBytesRead);
|
||||||
@@ -384,7 +384,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
|
|
||||||
private void writePingLater(
|
private void writePingLater(
|
||||||
final boolean reply, final int payload1, final int payload2, final Ping ping) {
|
final boolean reply, final int payload1, final int payload2, final Ping ping) {
|
||||||
executor.submit(new NamedRunnable("OkHttp %s ping %08x%08x",
|
executor.execute(new NamedRunnable("OkHttp %s ping %08x%08x",
|
||||||
hostName, payload1, payload2) {
|
hostName, payload1, payload2) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
try {
|
try {
|
||||||
@@ -636,7 +636,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
inFinished, headerBlock);
|
inFinished, headerBlock);
|
||||||
lastGoodStreamId = streamId;
|
lastGoodStreamId = streamId;
|
||||||
streams.put(streamId, newStream);
|
streams.put(streamId, newStream);
|
||||||
executor.submit(new NamedRunnable("OkHttp %s stream %d", hostName, streamId) {
|
executor.execute(new NamedRunnable("OkHttp %s stream %d", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
try {
|
try {
|
||||||
handler.receive(newStream);
|
handler.receive(newStream);
|
||||||
@@ -704,7 +704,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ackSettingsLater(final Settings peerSettings) {
|
private void ackSettingsLater(final Settings peerSettings) {
|
||||||
executor.submit(new NamedRunnable("OkHttp %s ACK Settings", hostName) {
|
executor.execute(new NamedRunnable("OkHttp %s ACK Settings", hostName) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
try {
|
try {
|
||||||
frameWriter.ackSettings(peerSettings);
|
frameWriter.ackSettings(peerSettings);
|
||||||
@@ -798,7 +798,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
}
|
}
|
||||||
currentPushRequests.add(streamId);
|
currentPushRequests.add(streamId);
|
||||||
}
|
}
|
||||||
pushExecutor.submit(new NamedRunnable("OkHttp %s Push Request[%s]", hostName, streamId) {
|
pushExecutor.execute(new NamedRunnable("OkHttp %s Push Request[%s]", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
boolean cancel = pushObserver.onRequest(streamId, requestHeaders);
|
boolean cancel = pushObserver.onRequest(streamId, requestHeaders);
|
||||||
try {
|
try {
|
||||||
@@ -816,7 +816,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
|
|
||||||
private void pushHeadersLater(final int streamId, final List<Header> requestHeaders,
|
private void pushHeadersLater(final int streamId, final List<Header> requestHeaders,
|
||||||
final boolean inFinished) {
|
final boolean inFinished) {
|
||||||
pushExecutor.submit(new NamedRunnable("OkHttp %s Push Headers[%s]", hostName, streamId) {
|
pushExecutor.execute(new NamedRunnable("OkHttp %s Push Headers[%s]", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
boolean cancel = pushObserver.onHeaders(streamId, requestHeaders, inFinished);
|
boolean cancel = pushObserver.onHeaders(streamId, requestHeaders, inFinished);
|
||||||
try {
|
try {
|
||||||
@@ -842,7 +842,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
source.require(byteCount); // Eagerly read the frame before firing client thread.
|
source.require(byteCount); // Eagerly read the frame before firing client thread.
|
||||||
source.read(buffer, byteCount);
|
source.read(buffer, byteCount);
|
||||||
if (buffer.size() != byteCount) throw new IOException(buffer.size() + " != " + byteCount);
|
if (buffer.size() != byteCount) throw new IOException(buffer.size() + " != " + byteCount);
|
||||||
pushExecutor.submit(new NamedRunnable("OkHttp %s Push Data[%s]", hostName, streamId) {
|
pushExecutor.execute(new NamedRunnable("OkHttp %s Push Data[%s]", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
try {
|
try {
|
||||||
boolean cancel = pushObserver.onData(streamId, buffer, byteCount, inFinished);
|
boolean cancel = pushObserver.onData(streamId, buffer, byteCount, inFinished);
|
||||||
@@ -859,7 +859,7 @@ public final class SpdyConnection implements Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void pushResetLater(final int streamId, final ErrorCode errorCode) {
|
private void pushResetLater(final int streamId, final ErrorCode errorCode) {
|
||||||
pushExecutor.submit(new NamedRunnable("OkHttp %s Push Reset[%s]", hostName, streamId) {
|
pushExecutor.execute(new NamedRunnable("OkHttp %s Push Reset[%s]", hostName, streamId) {
|
||||||
@Override public void execute() {
|
@Override public void execute() {
|
||||||
pushObserver.onReset(streamId, errorCode);
|
pushObserver.onReset(streamId, errorCode);
|
||||||
synchronized (SpdyConnection.this) {
|
synchronized (SpdyConnection.this) {
|
||||||
|
|||||||
Reference in New Issue
Block a user