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 ;
@@ -558,7 +559,7 @@ public synchronized String toString() {
558559
559560 // ======================================
560561 // Client-side inbound transactions.
561- static final class ClientInbound extends Inbound <ClientStreamListener > {
562+ static final class ClientInbound extends Inbound <ClientStreamListener , BinderClientTransport > {
562563
563564 private final boolean countsForInUse ;
564565
@@ -571,7 +572,10 @@ static final class ClientInbound extends Inbound<ClientStreamListener> {
571572 private Metadata trailers ;
572573
573574 ClientInbound (
574- BinderTransport transport , Attributes attributes , int callId , boolean countsForInUse ) {
575+ BinderClientTransport transport ,
576+ Attributes attributes ,
577+ int callId ,
578+ boolean countsForInUse ) {
575579 super (transport , attributes , callId );
576580 this .countsForInUse = countsForInUse ;
577581 }
@@ -615,13 +619,9 @@ protected void deliverCloseAbnormal(Status status) {
615619
616620 // ======================================
617621 // Server-side inbound transactions.
618- static final class ServerInbound extends Inbound <ServerStreamListener > {
619-
620- private final BinderServerTransport serverTransport ;
621-
622+ static final class ServerInbound extends Inbound <ServerStreamListener , BinderServerTransport > {
622623 ServerInbound (BinderServerTransport transport , Attributes attributes , int callId ) {
623624 super (transport , attributes , callId );
624- this .serverTransport = transport ;
625625 }
626626
627627 @ GuardedBy ("this" )
@@ -630,17 +630,16 @@ protected void handlePrefix(int flags, Parcel parcel) throws StatusException {
630630 String methodName = parcel .readString ();
631631 Metadata headers = MetadataHelper .readMetadata (parcel , attributes );
632632
633- StatsTraceContext statsTraceContext =
634- serverTransport .createStatsTraceContext (methodName , headers );
633+ StatsTraceContext statsTraceContext = transport .createStatsTraceContext (methodName , headers );
635634 Outbound .ServerOutbound outbound =
636- new Outbound .ServerOutbound (serverTransport , callId , statsTraceContext );
635+ new Outbound .ServerOutbound (transport , callId , statsTraceContext );
637636 ServerStream stream ;
638637 if ((flags & TransactionUtils .FLAG_EXPECT_SINGLE_MESSAGE ) != 0 ) {
639638 stream = new SingleMessageServerStream (this , outbound , attributes );
640639 } else {
641640 stream = new MultiMessageServerStream (this , outbound , attributes );
642641 }
643- Status status = serverTransport .startStream (stream , methodName , headers );
642+ Status status = transport .startStream (stream , methodName , headers );
644643 if (status .isOk ()) {
645644 checkNotNull (listener ); // Is it ok to assume this will happen synchronously?
646645 if (transport .isReady ()) {
0 commit comments