Skip to content

Commit 3974a3f

Browse files
spkrkasduskis
authored andcommitted
---
yaml --- r: 22355 b: refs/heads/autosynth-asset c: 03ba9c9 h: refs/heads/master i: 22353: 1778f8b 22351: 037aa5e
1 parent 1ca106b commit 3974a3f

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ refs/heads/autosynth-vision: 3866c747a5e87b5dfd530d7134907a7ed1fb16de
120120
refs/heads/spanner: b01127f885b4611bf1852abb0ce481eeb7fcc131
121121
refs/tags/v0.68.0: 9cc799fcf68c82ab431d425fefa58ef615ce8e5b
122122
refs/tags/v0.69.0: 78f67a29e8b9c46ba01de566a2eae0fd1c03edea
123-
refs/heads/autosynth-asset: 0a6fc39ab502f112b3cbdd671d8c79189c51bcdf
123+
refs/heads/autosynth-asset: 03ba9c91cab9113f30bfc43d185fc87d1b515303
124124
refs/heads/autosynth-automl: 2a8b018cf05811fd472e5d1053e67a12ceec0b64
125125
refs/heads/autosynth-bigquerydatatransfer: 564833a85642d4194adc025f021e10e723154246
126126
refs/heads/autosynth-bigquerystorage: a75c34ed7a11741669121be69a7021a00f1133ce

branches/autosynth-asset/google-cloud-clients/google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingImpl.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.google.cloud.MonitoredResourceDescriptor;
3838
import com.google.cloud.PageImpl;
3939
import com.google.cloud.logging.spi.v2.LoggingRpc;
40+
import com.google.common.annotations.VisibleForTesting;
4041
import com.google.common.base.Function;
4142
import com.google.common.base.Throwables;
4243
import com.google.common.collect.ImmutableList;
@@ -595,6 +596,9 @@ private void writeLogEntries(Iterable<LogEntry> logEntries, WriteOption... write
595596
case ASYNC:
596597
default:
597598
final ApiFuture<Void> writeFuture = writeAsync(logEntries, writeOptions);
599+
synchronized (writeLock) {
600+
pendingWrites.add(writeFuture);
601+
}
598602
ApiFutures.addCallback(
599603
writeFuture,
600604
new ApiFutureCallback<Void>() {
@@ -619,9 +623,6 @@ public void onFailure(Throwable t) {
619623
}
620624
}
621625
});
622-
synchronized (writeLock) {
623-
pendingWrites.add(writeFuture);
624-
}
625626
break;
626627
}
627628
}
@@ -707,4 +708,11 @@ public void close() throws Exception {
707708
}
708709
return optionMap;
709710
}
711+
712+
@VisibleForTesting
713+
int getNumPendingWrites() {
714+
synchronized (writeLock) {
715+
return pendingWrites.size();
716+
}
717+
}
710718
}

branches/autosynth-asset/google-cloud-clients/google-cloud-logging/src/test/java/com/google/cloud/logging/LoggingImplTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,7 @@ public void testWriteLogEntries() {
11861186
EasyMock.replay(rpcFactoryMock, loggingRpcMock);
11871187
logging = options.getService();
11881188
logging.write(ImmutableList.of(LOG_ENTRY1, LOG_ENTRY2));
1189+
assertEquals(0, ((LoggingImpl) logging).getNumPendingWrites());
11891190
}
11901191

11911192
@Test

0 commit comments

Comments
 (0)