Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.

Commit c089f6a

Browse files
committed
Revert "."
This reverts commit 9a29abe.
1 parent 9a29abe commit c089f6a

3 files changed

Lines changed: 5 additions & 20 deletions

File tree

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/FakeBigQueryWrite.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ public FakeBigQueryWrite() {
3434
serviceImpl = new FakeBigQueryWriteImpl();
3535
}
3636

37-
public void waitForResponseScheduled() throws InterruptedException {
38-
serviceImpl.waitResponseScheduled();
39-
}
40-
4137
@Override
4238
public List<AbstractMessage> getRequests() {
4339
return new LinkedList<AbstractMessage>(serviceImpl.getCapturedRequests());

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/FakeBigQueryWriteImpl.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.List;
2222
import java.util.concurrent.LinkedBlockingQueue;
2323
import java.util.concurrent.ScheduledExecutorService;
24-
import java.util.concurrent.Semaphore;
2524
import java.util.concurrent.TimeUnit;
2625
import java.util.concurrent.atomic.AtomicInteger;
2726
import java.util.logging.Logger;
@@ -45,7 +44,6 @@ class FakeBigQueryWriteImpl extends BigQueryWriteGrpc.BigQueryWriteImplBase {
4544
private boolean autoPublishResponse;
4645
private ScheduledExecutorService executor = null;
4746
private Duration responseDelay = Duration.ZERO;
48-
Semaphore responseCount = new Semaphore(0, true);
4947

5048
/** Class used to save the state of a possible response. */
5149
private static class Response {
@@ -113,11 +111,6 @@ public void flushRows(
113111
}
114112
}
115113

116-
// Wait for n responses to be scheduled to sent.
117-
public void waitResponseScheduled() throws InterruptedException {
118-
responseCount.acquire();
119-
}
120-
121114
@Override
122115
public StreamObserver<AppendRowsRequest> appendRows(
123116
final StreamObserver<AppendRowsResponse> responseObserver) {
@@ -143,7 +136,6 @@ public void run() {
143136
responseDelay.toMillis(),
144137
TimeUnit.MILLISECONDS);
145138
}
146-
responseCount.release();
147139
}
148140

149141
@Override

google-cloud-bigquerystorage/src/test/java/com/google/cloud/bigquery/storage/v1beta2/StreamWriterTest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,11 @@ public void run() {
452452
assertEquals(true, t.isAlive());
453453
assertEquals(false, appendFuture1.isDone());
454454
// Wait is necessary for response to be scheduled before timer is advanced.
455-
testBigQueryWrite.waitForResponseScheduled();
455+
Thread.sleep(5000L);
456456
fakeExecutor.advanceTime(Duration.ofSeconds(10));
457457
// The first requests gets back while the second one is blocked.
458458
assertEquals(2L, appendFuture1.get().getAppendResult().getOffset().getValue());
459-
testBigQueryWrite.waitForResponseScheduled();
459+
Thread.sleep(5000L);
460460
// Wait is necessary for response to be scheduled before timer is advanced.
461461
fakeExecutor.advanceTime(Duration.ofSeconds(10));
462462
t.join();
@@ -496,7 +496,7 @@ public void testFlowControlBehaviorException() throws Exception {
496496
ApiFuture<AppendRowsResponse> appendFuture1 = sendTestMessage(writer, new String[] {"A"});
497497
ApiFuture<AppendRowsResponse> appendFuture2 = sendTestMessage(writer, new String[] {"B"});
498498
// Wait is necessary for response to be scheduled before timer is advanced.
499-
testBigQueryWrite.waitForResponseScheduled();
499+
Thread.sleep(5000L);
500500
fakeExecutor.advanceTime(Duration.ofSeconds(10));
501501
try {
502502
appendFuture2.get();
@@ -944,11 +944,8 @@ public void testShutdownWithConnectionError() throws Exception {
944944

945945
ApiFuture<AppendRowsResponse> appendFuture1 = sendTestMessage(writer, new String[] {"A"});
946946
ApiFuture<AppendRowsResponse> appendFuture2 = sendTestMessage(writer, new String[] {"B"});
947-
ApiFuture<AppendRowsResponse> appendFuture3 = sendTestMessage(writer, new String[] {"C"});
948-
// Wait for all 3 response arrives.
949-
testBigQueryWrite.waitForResponseScheduled();
950-
testBigQueryWrite.waitForResponseScheduled();
951-
testBigQueryWrite.waitForResponseScheduled();
947+
ApiFuture<AppendRowsResponse> appendFuture3 = sendTestMessage(writer, new String[] {"B"});
948+
Thread.sleep(5000L);
952949
// Move the needle for responses to be sent.
953950
fakeExecutor.advanceTime(Duration.ofSeconds(20));
954951
// Shutdown writer immediately and there will be some error happened when flushing the queue.

0 commit comments

Comments
 (0)