Skip to content

Commit

Permalink
Documentation and format
Browse files Browse the repository at this point in the history
  • Loading branch information
yihanzhen committed Apr 16, 2018
1 parent 067a190 commit ef50e69
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1056,13 +1056,15 @@ ResultSet executeQueryInternalWithOptions(
new ResumableStreamIterator(MAX_BUFFERED_CHUNKS, QUERY) {
@Override
CloseableIterator<PartialResultSet> startStream(@Nullable ByteString resumeToken) {
return new CloseableServerStreamIterator<PartialResultSet>(rpc.executeQuery(
resumeToken == null
? request
: request.toBuilder().setResumeToken(resumeToken).build(),
null,
session.options));

return new CloseableServerStreamIterator<PartialResultSet>(
rpc.executeQuery(
resumeToken == null
? request
: request.toBuilder().setResumeToken(resumeToken).build(),
null,
session.options));

// TODO(hzyi): make resume work
// Let resume fail for now. Gapic has its own resume, but in order not
// to introduce too much change at a time, we decide to plumb up
// ServerStream first and then figure out how to make resume work
Expand Down Expand Up @@ -1165,13 +1167,15 @@ ResultSet readInternalWithOptions(
new ResumableStreamIterator(MAX_BUFFERED_CHUNKS, READ) {
@Override
CloseableIterator<PartialResultSet> startStream(@Nullable ByteString resumeToken) {
return new CloseableServerStreamIterator<PartialResultSet>(rpc.read(
resumeToken == null
? request
: request.toBuilder().setResumeToken(resumeToken).build(),
null,
session.options));
return new CloseableServerStreamIterator<PartialResultSet>(
rpc.read(
resumeToken == null
? request
: request.toBuilder().setResumeToken(resumeToken).build(),
null,
session.options));

// TODO(hzyi): make resume work
// Let resume fail for now. Gapic has its own resume, but in order not
// to introduce too much change at a time, we decide to plumb up
// ServerStream first and then figure out how to make resume work
Expand Down Expand Up @@ -2310,6 +2314,11 @@ public T next() {
}
}

@Override
public void remove() {
throw new UnsupportedOperationException("Not supported: remove.");
}

@Override
public void close(@Nullable String message) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ResponseObserver;
import com.google.api.gax.rpc.ServerStream;
import com.google.api.gax.rpc.ServerStreamingCallable;
import com.google.api.gax.rpc.StreamController;
import com.google.common.base.Preconditions;
Expand All @@ -28,6 +27,10 @@
import java.util.Queue;
import java.util.concurrent.CancellationException;

/**
* TODO(hzyi): convert this class into a general utility class
* This class is copied from gax and is used for testing ServerStream only.
*/
public class ServerStreamingStashCallable<RequestT, ResponseT>
extends ServerStreamingCallable<RequestT, ResponseT> {
private List<ResponseT> responseList;
Expand Down

0 comments on commit ef50e69

Please sign in to comment.