public void run(Timeout timeout) {
onReceiveTimeoutFired(request);
}
});
Timeout timeout;
try {
timeout = timer.newTimeout(receiveTimeoutTask, receiveTimeoutMs, TimeUnit.MILLISECONDS);
}
catch (IllegalStateException e) {
throw new TTransportException("Unable to schedule request timeout");
}
request.setReceiveTimeout(timeout);
}
}
if (this.readTimeout != null) {
long readTimeoutNanos = this.readTimeout.roundTo(TimeUnit.NANOSECONDS);
if (readTimeoutNanos > 0) {
TimerTask readTimeoutTask = new IoThreadBoundTimerTask(this, new ReadTimeoutTask(readTimeoutNanos, request));
Timeout timeout;
try {
timeout = timer.newTimeout(readTimeoutTask, readTimeoutNanos, TimeUnit.NANOSECONDS);
}
catch (IllegalStateException e) {
throw new TTransportException("Unable to schedule read timeout");