(final Status reason)
| 313 | |
| 314 | // When this method returns, passThrough is guaranteed to be true |
| 315 | @Override |
| 316 | public void cancel(final Status reason) { |
| 317 | checkState(listener != null, "May only be called after start"); |
| 318 | checkNotNull(reason, "reason"); |
| 319 | boolean delegateToRealStream = true; |
| 320 | synchronized (this) { |
| 321 | // If realStream != null, then either setStream() or cancel() has been called |
| 322 | if (realStream == null) { |
| 323 | setRealStream(NoopClientStream.INSTANCE); |
| 324 | delegateToRealStream = false; |
| 325 | error = reason; |
| 326 | } |
| 327 | } |
| 328 | if (delegateToRealStream) { |
| 329 | delayOrExecute(new Runnable() { |
| 330 | @Override |
| 331 | public void run() { |
| 332 | realStream.cancel(reason); |
| 333 | } |
| 334 | }); |
| 335 | } else { |
| 336 | drainPendingCalls(); |
| 337 | onEarlyCancellation(reason); |
| 338 | // Note that listener is a DelayedStreamListener |
| 339 | listener.closed(reason, RpcProgress.PROCESSED, new Metadata()); |
| 340 | } |
| 341 | } |
| 342 | |
| 343 | protected void onEarlyCancellation(Status reason) { |
| 344 | } |
nothing calls this directly
no test coverage detected