public class CallMetricsListener
extends okhttp3.EventListener
构造器和说明 |
---|
CallMetricsListener(okhttp3.Call call) |
限定符和类型 | 方法和说明 |
---|---|
void |
connectEnd(okhttp3.Call call,
java.net.InetSocketAddress inetSocketAddress,
java.net.Proxy proxy,
okhttp3.Protocol protocol)
Invoked immediately after a socket connection was attempted.
|
void |
connectFailed(okhttp3.Call call,
java.net.InetSocketAddress inetSocketAddress,
java.net.Proxy proxy,
okhttp3.Protocol protocol,
java.io.IOException ioe)
Invoked when a connection attempt fails.
|
void |
connectStart(okhttp3.Call call,
java.net.InetSocketAddress inetSocketAddress,
java.net.Proxy proxy)
Invoked just prior to initiating a socket connection.
|
void |
dnsEnd(okhttp3.Call call,
java.lang.String domainName,
java.util.List<java.net.InetAddress> inetAddressList)
Invoked immediately after a DNS lookup.
|
void |
dnsStart(okhttp3.Call call,
java.lang.String domainName)
Invoked just prior to a DNS lookup.
|
java.util.List<java.net.InetAddress> |
dumpDns() |
void |
dumpMetrics(HttpTaskMetrics metrics) |
void |
requestBodyEnd(okhttp3.Call call,
long byteCount)
Invoked immediately after sending a request body.
|
void |
requestBodyStart(okhttp3.Call call)
Invoked just prior to sending a request body.
|
void |
requestHeadersEnd(okhttp3.Call call,
okhttp3.Request request)
Invoked immediately after sending request headers.
|
void |
requestHeadersStart(okhttp3.Call call)
Invoked just prior to sending request headers.
|
void |
responseBodyEnd(okhttp3.Call call,
long byteCount)
Invoked immediately after receiving a response body and completing reading it.
|
void |
responseBodyStart(okhttp3.Call call)
Invoked just prior to receiving the response body.
|
void |
responseHeadersEnd(okhttp3.Call call,
okhttp3.Response response)
Invoked immediately after receiving response headers.
|
void |
responseHeadersStart(okhttp3.Call call)
Invoked just prior to receiving response headers.
|
void |
secureConnectEnd(okhttp3.Call call,
okhttp3.Handshake handshake)
Invoked immediately after a TLS connection was attempted.
|
void |
secureConnectStart(okhttp3.Call call)
Invoked just prior to initiating a TLS connection.
|
java.lang.String |
toString()
Returns a string representation of the object.
|
public void dnsStart(okhttp3.Call call, java.lang.String domainName)
okhttp3.EventListener
Dns.lookup(String)
.
This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different host.
If the Call
is able to reuse an existing pooled connection, this method will not be
invoked. See ConnectionPool
.
dnsStart
在类中 okhttp3.EventListener
public void dnsEnd(okhttp3.Call call, java.lang.String domainName, java.util.List<java.net.InetAddress> inetAddressList)
okhttp3.EventListener
This method is invoked after EventListener.dnsStart(okhttp3.Call, java.lang.String)
.
dnsEnd
在类中 okhttp3.EventListener
public void connectStart(okhttp3.Call call, java.net.InetSocketAddress inetSocketAddress, java.net.Proxy proxy)
okhttp3.EventListener
This method will be invoked if no existing connection in the ConnectionPool
can be
reused.
This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different address, or a connection is retried.
connectStart
在类中 okhttp3.EventListener
public void connectEnd(okhttp3.Call call, java.net.InetSocketAddress inetSocketAddress, java.net.Proxy proxy, okhttp3.Protocol protocol)
okhttp3.EventListener
If the call
uses HTTPS, this will be invoked after
EventListener.secureConnectEnd(Call, Handshake)
, otherwise it will invoked after
EventListener.connectStart(Call, InetSocketAddress, Proxy)
.
connectEnd
在类中 okhttp3.EventListener
public void connectFailed(okhttp3.Call call, java.net.InetSocketAddress inetSocketAddress, java.net.Proxy proxy, okhttp3.Protocol protocol, java.io.IOException ioe)
okhttp3.EventListener
If the call
uses HTTPS, this will be invoked after EventListener.secureConnectEnd(Call,
Handshake)
, otherwise it will invoked after EventListener.connectStart(Call, InetSocketAddress,
Proxy)
.
connectFailed
在类中 okhttp3.EventListener
public void secureConnectStart(okhttp3.Call call)
okhttp3.EventListener
This method is invoked if the following conditions are met:
Call.request()
requires TLS.ConnectionPool
can be reused.This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different address, or a connection is retried.
secureConnectStart
在类中 okhttp3.EventListener
public void secureConnectEnd(okhttp3.Call call, okhttp3.Handshake handshake)
okhttp3.EventListener
This method is invoked after EventListener.secureConnectStart(okhttp3.Call)
.
secureConnectEnd
在类中 okhttp3.EventListener
public void requestHeadersStart(okhttp3.Call call)
okhttp3.EventListener
The connection is implicit, and will generally relate to the last
EventListener.connectionAcquired(Call, Connection)
event.
This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different address.
requestHeadersStart
在类中 okhttp3.EventListener
public void requestHeadersEnd(okhttp3.Call call, okhttp3.Request request)
okhttp3.EventListener
This method is always invoked after EventListener.requestHeadersStart(Call)
.
requestHeadersEnd
在类中 okhttp3.EventListener
request
- the request sent over the network. It is an error to access the body of this
request.public void requestBodyStart(okhttp3.Call call)
okhttp3.EventListener
The connection is implicit, and will generally relate to the last
EventListener.connectionAcquired(Call, Connection)
event.
This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different address.
requestBodyStart
在类中 okhttp3.EventListener
public void requestBodyEnd(okhttp3.Call call, long byteCount)
okhttp3.EventListener
This method is always invoked after EventListener.requestBodyStart(Call)
.
requestBodyEnd
在类中 okhttp3.EventListener
public void responseHeadersStart(okhttp3.Call call)
okhttp3.EventListener
The connection is implicit, and will generally relate to the last
EventListener.connectionAcquired(Call, Connection)
event.
This can be invoked more than 1 time for a single Call
. For example, if the response
to the Call.request()
is a redirect to a different address.
responseHeadersStart
在类中 okhttp3.EventListener
public void responseHeadersEnd(okhttp3.Call call, okhttp3.Response response)
okhttp3.EventListener
This method is always invoked after EventListener.responseHeadersStart(okhttp3.Call)
.
responseHeadersEnd
在类中 okhttp3.EventListener
response
- the response received over the network. It is an error to access the body of
this response.public void responseBodyStart(okhttp3.Call call)
okhttp3.EventListener
The connection is implicit, and will generally relate to the last
EventListener.connectionAcquired(Call, Connection)
event.
This will usually be invoked only 1 time for a single Call
,
exceptions are a limited set of cases including failure recovery.
responseBodyStart
在类中 okhttp3.EventListener
public void responseBodyEnd(okhttp3.Call call, long byteCount)
okhttp3.EventListener
Will only be invoked for requests having a response body e.g. won't be invoked for a websocket upgrade.
This method is always invoked after EventListener.requestBodyStart(Call)
.
responseBodyEnd
在类中 okhttp3.EventListener
public void dumpMetrics(HttpTaskMetrics metrics)
public java.util.List<java.net.InetAddress> dumpDns()
@NonNull public java.lang.String toString()
java.lang.Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())
toString
在类中 java.lang.Object