From a18d4e184b224d1567ffc1faa5502a5eeaf5445c Mon Sep 17 00:00:00 2001 From: Neil Fuller Date: Tue, 31 May 2016 10:15:06 +0100 Subject: [PATCH] Remove methods from FramedConnection that are unused While investigating an Android issue with these methods I found they were not used. Tidying up. --- .../internal/framed/FramedConnection.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java b/okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java index 90c8e3805729..336f466cdfdf 100644 --- a/okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java +++ b/okhttp/src/main/java/okhttp3/internal/framed/FramedConnection.java @@ -86,7 +86,6 @@ public final class FramedConnection implements Closeable { private int lastGoodStreamId; private int nextStreamId; private boolean shutdown; - private long idleStartTimeNs = System.nanoTime(); /** Ensures push promise callbacks events are sent in order per stream. */ private final ExecutorService pushExecutor; @@ -190,34 +189,14 @@ synchronized FramedStream getStream(int id) { synchronized FramedStream removeStream(int streamId) { FramedStream stream = streams.remove(streamId); - if (stream != null && streams.isEmpty()) { - setIdle(true); - } notifyAll(); // The removed stream may be blocked on a connection-wide window update. return stream; } - private synchronized void setIdle(boolean value) { - idleStartTimeNs = value ? System.nanoTime() : Long.MAX_VALUE; - } - - /** Returns true if this connection is idle. */ - public synchronized boolean isIdle() { - return idleStartTimeNs != Long.MAX_VALUE; - } - public synchronized int maxConcurrentStreams() { return peerSettings.getMaxConcurrentStreams(Integer.MAX_VALUE); } - /** - * Returns the time in ns when this connection became idle or Long.MAX_VALUE if connection is not - * idle. - */ - public synchronized long getIdleStartTimeNs() { - return idleStartTimeNs; - } - /** * Returns a new server-initiated stream. * @@ -264,7 +243,6 @@ private FramedStream newStream(int associatedStreamId, List
requestHeade flushHeaders = !out || bytesLeftInWriteWindow == 0L || stream.bytesLeftInWriteWindow == 0L; if (stream.isOpen()) { streams.put(streamId, stream); - setIdle(false); } } if (associatedStreamId == 0) { @@ -460,7 +438,6 @@ private void close(ErrorCode connectionCode, ErrorCode streamCode) throws IOExce if (!streams.isEmpty()) { streamsToClose = streams.values().toArray(new FramedStream[streams.size()]); streams.clear(); - setIdle(false); } if (pings != null) { pingsToCancel = pings.values().toArray(new Ping[pings.size()]);