@@ -235,7 +235,7 @@ public static <ReqT, RespT> Iterator<RespT> blockingServerStreamingCall(
235
235
* @throws StatusException if the write to the server failed
236
236
*/
237
237
@ ExperimentalApi ("https://github.com/grpc/grpc-java/issues/10918" )
238
- public static <ReqT , RespT > BlockingClientCall <? , RespT > blockingV2ServerStreamingCall (
238
+ public static <ReqT , RespT > BlockingClientCall <ReqT , RespT > blockingV2ServerStreamingCall (
239
239
Channel channel , MethodDescriptor <ReqT , RespT > method , CallOptions callOptions , ReqT req )
240
240
throws InterruptedException , StatusException {
241
241
BlockingClientCall <ReqT , RespT > call =
@@ -436,7 +436,7 @@ private abstract static class StartableListener<T> extends ClientCall.Listener<T
436
436
abstract void onStart ();
437
437
}
438
438
439
- private static class CallToStreamObserverAdapter <ReqT >
439
+ private static final class CallToStreamObserverAdapter <ReqT >
440
440
extends ClientCallStreamObserver <ReqT > {
441
441
private boolean frozen ;
442
442
private final ClientCall <ReqT , ?> call ;
@@ -787,7 +787,7 @@ void onStart() {
787
787
}
788
788
789
789
@ SuppressWarnings ("serial" )
790
- static final class ThreadlessExecutor extends ConcurrentLinkedQueue <Runnable >
790
+ private static final class ThreadlessExecutor extends ConcurrentLinkedQueue <Runnable >
791
791
implements Executor {
792
792
private static final Logger log = Logger .getLogger (ThreadlessExecutor .class .getName ());
793
793
@@ -804,12 +804,14 @@ static final class ThreadlessExecutor extends ConcurrentLinkedQueue<Runnable>
804
804
* Must only be called by one thread at a time.
805
805
*/
806
806
public void waitAndDrain () throws InterruptedException {
807
+ throwIfInterrupted ();
807
808
Runnable runnable = poll ();
808
809
if (runnable == null ) {
809
810
waiter = Thread .currentThread ();
810
811
try {
811
812
while ((runnable = poll ()) == null ) {
812
813
LockSupport .park (this );
814
+ throwIfInterrupted ();
813
815
}
814
816
} finally {
815
817
waiter = null ;
@@ -820,6 +822,12 @@ public void waitAndDrain() throws InterruptedException {
820
822
} while ((runnable = poll ()) != null );
821
823
}
822
824
825
+ private static void throwIfInterrupted () throws InterruptedException {
826
+ if (Thread .interrupted ()) {
827
+ throw new InterruptedException ();
828
+ }
829
+ }
830
+
823
831
/**
824
832
* Called after final call to {@link #waitAndDrain()}, from same thread.
825
833
*/
@@ -857,7 +865,7 @@ static final class ThreadSafeThreadlessExecutor extends ConcurrentLinkedQueue<Ru
857
865
private static final Logger log =
858
866
Logger .getLogger (ThreadSafeThreadlessExecutor .class .getName ());
859
867
860
- private Lock waiterLock = new ReentrantLock ();
868
+ private final Lock waiterLock = new ReentrantLock ();
861
869
private final Condition waiterCondition = waiterLock .newCondition ();
862
870
863
871
// Non private to avoid synthetic class
0 commit comments