Minor fixes/improvements

Cancel was the only method for implementing ClientStream that was not
final, even though it isn't really any different from the other methods.
This commit is contained in:
Eric Anderson 2015-07-23 10:50:02 -07:00
parent 5abe321b81
commit afdbe19937
1 changed files with 2 additions and 2 deletions

View File

@ -168,7 +168,7 @@ public abstract class AbstractClientStream<IdT> extends AbstractStream<IdT>
protected void inboundTrailersReceived(Metadata.Trailers trailers, Status status) { protected void inboundTrailersReceived(Metadata.Trailers trailers, Status status) {
Preconditions.checkNotNull(trailers, "trailers"); Preconditions.checkNotNull(trailers, "trailers");
if (inboundPhase() == Phase.STATUS) { if (inboundPhase() == Phase.STATUS) {
log.log(Level.INFO, "Received trailers on closed stream {0}\n {1}\n {3}", log.log(Level.INFO, "Received trailers on closed stream {0}\n {1}\n {2}",
new Object[]{id(), status, trailers}); new Object[]{id(), status, trailers});
} }
// Stash the status & trailers so they can be delivered by the deframer calls // Stash the status & trailers so they can be delivered by the deframer calls
@ -281,7 +281,7 @@ public abstract class AbstractClientStream<IdT> extends AbstractStream<IdT>
* Cancel the stream. Called by the application layer, never called by the transport. * Cancel the stream. Called by the application layer, never called by the transport.
*/ */
@Override @Override
public void cancel(Status reason) { public final void cancel(Status reason) {
Preconditions.checkArgument(EnumSet.of(CANCELLED, DEADLINE_EXCEEDED).contains(reason.getCode()), Preconditions.checkArgument(EnumSet.of(CANCELLED, DEADLINE_EXCEEDED).contains(reason.getCode()),
"Invalid cancellation reason"); "Invalid cancellation reason");
outboundPhase(Phase.STATUS); outboundPhase(Phase.STATUS);