private final class ConnectionManager.OutboundMux extends MuxClient
Modifier and Type | Field and Description |
---|---|
private Connection |
c
The outbound connection.
|
private long |
idleTime
The time this mux was found to be idle by the Reaper
thread.
|
private int |
pendingNewRequests
Number of pending newRequest calls.
|
private boolean |
pendingStart
True if the mux needs to be started.
|
private Object |
startLock
Lock to enforce single start of mux.
|
MAX_REQUESTS
Constructor and Description |
---|
ConnectionManager.OutboundMux(Connection c)
Constructs an instance from the connection's streams.
|
ConnectionManager.OutboundMux(Connection c,
boolean ignore)
Constructs an instance from the connection's channel.
|
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
checkIdle(long now)
Returns true if the mux is dead, or the mux is idle and the
recorded idle time is more than TIMEOUT milliseconds before now,
and returns false otherwise.
|
(package private) Connection |
getConnection()
Returns the outbound connection.
|
protected void |
handleDown()
Close the connection, so that the provider is notified.
|
OutboundRequest |
newRequest()
Initiates a new request on the mux and returns it, and sets the
idle time to zero.
|
(package private) void |
newRequestPending()
Registers a pending newRequest call.
|
int |
requestsInProgress()
Returns the number of active and pending requests.
|
(package private) boolean |
shouldRetry() |
populateContext, shutdown
setStartTimeout, start
private final Connection c
private final Object startLock
private boolean pendingStart
private int pendingNewRequests
private long idleTime
ConnectionManager.OutboundMux(Connection c) throws IOException
IOException
ConnectionManager.OutboundMux(Connection c, boolean ignore) throws IOException
IOException
Connection getConnection()
void newRequestPending()
public OutboundRequest newRequest() throws IOException
newRequest
in class MuxClient
IOException
public int requestsInProgress() throws IOException
requestsInProgress
in class MuxClient
IOException
- if the multiplexed connection is no longer
activeboolean checkIdle(long now)
protected void handleDown()
handleDown
in class Mux
boolean shouldRetry()
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.