Skip to content

Commit 2360771

Browse files
authored
binder: Hold lock when calling setOutgoingBinder()
setOutgoingBinder() has `@GuardedBy` for the transport. ``` binder/src/main/java/io/grpc/binder/internal/BinderServerTransport.java:71: error: [GuardedBy] This access should be guarded by 'transport', which is not currently held transport.setOutgoingBinder( ^ ```
1 parent 1ef5ee2 commit 2360771

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

binder/src/main/java/io/grpc/binder/internal/BinderServerTransport.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ public static BinderServerTransport create(
6868
// TODO(jdcormie): Plumb in the Server's executor() and use it here instead.
6969
// No need to handle failure here because if 'callbackBinder' is already dead, we'll notice it
7070
// again in start() when we send the first transaction.
71-
transport.setOutgoingBinder(
72-
OneWayBinderProxy.wrap(callbackBinder, transport.getScheduledExecutorService()));
71+
synchronized (transport) {
72+
transport.setOutgoingBinder(
73+
OneWayBinderProxy.wrap(callbackBinder, transport.getScheduledExecutorService()));
74+
}
7375
return transport;
7476
}
7577

0 commit comments

Comments
 (0)