public abstract class ForwardingOngoingRequest extends Object implements OngoingRequest
OngoingRequest
useful for implementing decorators.PORT_ZERO, UNKNOWN_SERVER_INFO
Modifier | Constructor and Description |
---|---|
protected |
ForwardingOngoingRequest(OngoingRequest delegate) |
Modifier and Type | Method and Description |
---|---|
long |
arrivalTimeNanos()
Get the arrival time of the incoming request in nanoseconds.
|
void |
drop()
Drop the request.
|
boolean |
isExpired() |
void |
reply(Response<okio.ByteString> response)
Reply to the request with a
Response . |
Request |
request()
Returns the
Request . |
ServerInfo |
serverInfo()
Returns an identifier for the server where this request originated.
|
protected ForwardingOngoingRequest(OngoingRequest delegate)
public Request request()
OngoingRequest
Request
.request
in interface OngoingRequest
public void reply(Response<okio.ByteString> response)
OngoingRequest
Response
.reply
in interface OngoingRequest
response
- Response to send as replypublic void drop()
OngoingRequest
drop
in interface OngoingRequest
public boolean isExpired()
isExpired
in interface OngoingRequest
public ServerInfo serverInfo()
OngoingRequest
serverInfo
in interface OngoingRequest
public long arrivalTimeNanos()
OngoingRequest
System.nanoTime()
. To get unix epoch
time, do something like:
long processingTimeNanos = System.nanoTime() - requestContext.arrivalTimeNanos();
long arrivalTimeUnixEpochMillis = System.currentTimeMillis() +
TimeUnit.NANOSECONDS.toMillis(processingTimeNanos);
arrivalTimeNanos
in interface OngoingRequest
System.nanoTime()
Copyright © 2016. All rights reserved.