public abstract class EventListener extends Object
All start/connect/acquire events will eventually receive a matching end/release event, either successful (non-null parameters), or failed (non-null throwable). The first core parameters of each event pair are used to link the event in case of concurrent or repeated events e.g. dnsStart(call, domainName) -> dnsEnd(call, domainName, inetAddressList).
Nesting is as follows
Request events are ordered: requestHeaders -> requestBody -> responseHeaders -> responseBody
Since connections may be reused, the dns and connect events may not be present for a call, or may be repeated in case of failure retries, even concurrently in case of happy eyeballs type scenarios. A redirect cross entity, or to use https may cause additional connection and request events.
All event methods must execute fast, without external locking, cannot throw exceptions, attempt to mutate the event parameters, or be reentrant back into the client. Any IO - writing to files or network should be done asynchronously.
| Modifier and Type | Class and Description |
|---|---|
static interface |
EventListener.Factory |
| Modifier and Type | Field and Description |
|---|---|
static EventListener |
NONE |
| Constructor and Description |
|---|
EventListener() |
| Modifier and Type | Method and Description |
|---|---|
void |
callEnd(Call call) |
void |
callFailed(Call call,
IOException ioe) |
void |
callStart(Call call) |
void |
connectEnd(Call call,
InetSocketAddress inetSocketAddress,
Proxy proxy,
Protocol protocol) |
void |
connectFailed(Call call,
InetSocketAddress inetSocketAddress,
Proxy proxy,
Protocol protocol,
IOException ioe) |
void |
connectionAcquired(Call call,
Connection connection) |
void |
connectionReleased(Call call,
Connection connection) |
void |
connectStart(Call call,
InetSocketAddress inetSocketAddress,
Proxy proxy) |
void |
dnsEnd(Call call,
String domainName,
List<InetAddress> inetAddressList) |
void |
dnsStart(Call call,
String domainName) |
void |
requestBodyEnd(Call call,
long byteCount) |
void |
requestBodyStart(Call call) |
void |
requestHeadersEnd(Call call,
Request request) |
void |
requestHeadersStart(Call call) |
void |
responseBodyEnd(Call call,
long byteCount) |
void |
responseBodyStart(Call call) |
void |
responseHeadersEnd(Call call,
Response response) |
void |
responseHeadersStart(Call call) |
void |
secureConnectEnd(Call call,
Handshake handshake) |
void |
secureConnectStart(Call call) |
public static final EventListener NONE
public void callStart(Call call)
public void dnsEnd(Call call, String domainName, List<InetAddress> inetAddressList)
public void connectStart(Call call, InetSocketAddress inetSocketAddress, Proxy proxy)
public void secureConnectStart(Call call)
public void connectEnd(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol)
public void connectFailed(Call call, InetSocketAddress inetSocketAddress, Proxy proxy, Protocol protocol, IOException ioe)
public void connectionAcquired(Call call, Connection connection)
public void connectionReleased(Call call, Connection connection)
public void requestHeadersStart(Call call)
public void requestBodyStart(Call call)
public void requestBodyEnd(Call call, long byteCount)
public void responseHeadersStart(Call call)
public void responseBodyStart(Call call)
public void responseBodyEnd(Call call, long byteCount)
public void callEnd(Call call)
public void callFailed(Call call, IOException ioe)
Copyright © 2019. All rights reserved.