Package 

Class BinderTransport

  • All Implemented Interfaces:
    android.os.IBinder.DeathRecipient , io.grpc.binder.internal.LeakSafeOneWayBinder.TransactionHandler

    @ThreadSafe() 
    public abstract class BinderTransport
     implements LeakSafeOneWayBinder.TransactionHandler, IBinder.DeathRecipient
                        

    Base class for binder-based gRPC transport.

    This is used on both the client and service sides of the transport.

    A note on synchronization. The nature of this class's interaction with each stream (bi-directional communication between gRPC calls and binder transactions) means that acquiring multiple locks in two different orders can happen easily. E.g. binder transactions will arrive in this class, and need to passed to a stream instance, whereas gRPC calls on a stream instance will need to call into this class to send a transaction (possibly waiting for the transport to become ready).

    The split between Outbound & Inbound helps reduce this risk, but not entirely remove it.

    For this reason, while most state within this class is guarded by this instance, methods exposed to individual stream instances need to use atomic or volatile types, since those calls will already be synchronized on the individual RPC objects.

    IMPORTANT: This implementation must comply with this published wire format. https://github.com/grpc/proposal/blob/master/L73-java-binderchannel/wireformat.md