Skip to content

Commit cef75cd

Browse files
committed
add terminal_error check
1 parent 6ea8379 commit cef75cd

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

java-storage/google-cloud-storage/src/main/java/com/google/cloud/storage/BidiUploadStreamingStream.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ public void flush() {
165165
public boolean finishWrite(long length) {
166166
lock.lock();
167167
try {
168-
if (state.getState() == State.TERMINAL_SUCCESS) {
168+
State currentState = state.getState();
169+
if (currentState == State.TERMINAL_SUCCESS || currentState == State.TERMINAL_ERROR) {
169170
return true;
170171
}
171172
// if we're already finalizing, ack rather than enqueueing again
@@ -195,7 +196,8 @@ public boolean closeStream(long length) {
195196
lock.lock();
196197
try {
197198

198-
if (state.getState() == State.TERMINAL_SUCCESS) {
199+
State currentState = state.getState();
200+
if (currentState == State.TERMINAL_SUCCESS || currentState == State.TERMINAL_ERROR) {
199201
return true;
200202
}
201203

0 commit comments

Comments
 (0)