4242 *
4343 * <p>Out-of-order messages are reassembled into their correct order.
4444 */
45- abstract class Inbound <L extends StreamListener > implements StreamListener .MessageProducer {
45+ abstract class Inbound <L extends StreamListener , T extends BinderTransport >
46+ implements StreamListener .MessageProducer {
4647
47- protected final BinderTransport transport ;
48+ protected final T transport ;
4849 protected final Attributes attributes ;
4950 final int callId ;
5051
@@ -145,7 +146,7 @@ enum State {
145146 @ GuardedBy ("this" )
146147 private boolean producingMessages ;
147148
148- private Inbound (BinderTransport transport , Attributes attributes , int callId ) {
149+ private Inbound (T transport , Attributes attributes , int callId ) {
149150 this .transport = transport ;
150151 this .attributes = attributes ;
151152 this .callId = callId ;
@@ -551,7 +552,7 @@ public synchronized String toString() {
551552
552553 // ======================================
553554 // Client-side inbound transactions.
554- static final class ClientInbound extends Inbound <ClientStreamListener > {
555+ static final class ClientInbound extends Inbound <ClientStreamListener , BinderClientTransport > {
555556
556557 private final boolean countsForInUse ;
557558
@@ -564,7 +565,10 @@ static final class ClientInbound extends Inbound<ClientStreamListener> {
564565 private Metadata trailers ;
565566
566567 ClientInbound (
567- BinderTransport transport , Attributes attributes , int callId , boolean countsForInUse ) {
568+ BinderClientTransport transport ,
569+ Attributes attributes ,
570+ int callId ,
571+ boolean countsForInUse ) {
568572 super (transport , attributes , callId );
569573 this .countsForInUse = countsForInUse ;
570574 }
@@ -608,13 +612,9 @@ protected void deliverCloseAbnormal(Status status) {
608612
609613 // ======================================
610614 // Server-side inbound transactions.
611- static final class ServerInbound extends Inbound <ServerStreamListener > {
612-
613- private final BinderServerTransport serverTransport ;
614-
615+ static final class ServerInbound extends Inbound <ServerStreamListener , BinderServerTransport > {
615616 ServerInbound (BinderServerTransport transport , Attributes attributes , int callId ) {
616617 super (transport , attributes , callId );
617- this .serverTransport = transport ;
618618 }
619619
620620 @ GuardedBy ("this" )
@@ -623,17 +623,16 @@ protected void handlePrefix(int flags, Parcel parcel) throws StatusException {
623623 String methodName = parcel .readString ();
624624 Metadata headers = MetadataHelper .readMetadata (parcel , attributes );
625625
626- StatsTraceContext statsTraceContext =
627- serverTransport .createStatsTraceContext (methodName , headers );
626+ StatsTraceContext statsTraceContext = transport .createStatsTraceContext (methodName , headers );
628627 Outbound .ServerOutbound outbound =
629- new Outbound .ServerOutbound (serverTransport , callId , statsTraceContext );
628+ new Outbound .ServerOutbound (transport , callId , statsTraceContext );
630629 ServerStream stream ;
631630 if ((flags & TransactionUtils .FLAG_EXPECT_SINGLE_MESSAGE ) != 0 ) {
632631 stream = new SingleMessageServerStream (this , outbound , attributes );
633632 } else {
634633 stream = new MultiMessageServerStream (this , outbound , attributes );
635634 }
636- Status status = serverTransport .startStream (stream , methodName , headers );
635+ Status status = transport .startStream (stream , methodName , headers );
637636 if (status .isOk ()) {
638637 checkNotNull (listener ); // Is it ok to assume this will happen synchronously?
639638 if (transport .isReady ()) {
0 commit comments