Skip to content

Commit a5fa38c

Browse files
committed
Give that code some comments; code loves comments
1 parent ef0257f commit a5fa38c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/src/main/java/io/grpc/internal/DelayedStream.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,16 @@ final void setStream(ClientStream stream) {
8989
passThrough = true;
9090
break;
9191
}
92+
// Since there were pendingCalls, we need to process them. To maintain ordering we can't set
93+
// passThrough=true until we run all pendingCalls, but new Runnables may be added after we
94+
// drop the lock. So we will have to re-check pendingCalls.
9295
List<Runnable> tmp = toRun;
9396
toRun = pendingCalls;
9497
pendingCalls = tmp;
9598
}
9699
for (Runnable runnable : toRun) {
100+
// Must not call transport while lock is held to prevent deadlocks.
101+
// TODO(ejona): exception handling
97102
runnable.run();
98103
}
99104
toRun.clear();

0 commit comments

Comments
 (0)