|
20 | 20 | import static java.util.concurrent.Executors.callable; |
21 | 21 |
|
22 | 22 | import com.google.api.services.storage.model.StorageObject; |
23 | | -import com.google.gcloud.RetryHelper; |
24 | 23 | import com.google.gcloud.spi.StorageRpc; |
25 | 24 |
|
26 | 25 | import java.io.IOException; |
@@ -69,16 +68,12 @@ private void writeObject(ObjectOutputStream out) throws IOException { |
69 | 68 | private void flush(boolean compact) { |
70 | 69 | if (limit >= chunkSize || compact && limit >= MIN_CHUNK_SIZE) { |
71 | 70 | final int length = limit - limit % MIN_CHUNK_SIZE; |
72 | | - try { |
73 | | - runWithRetries(callable(new Runnable() { |
74 | | - @Override |
75 | | - public void run() { |
76 | | - storageRpc.write(uploadId, buffer, 0, storageObject, position, length, false); |
77 | | - } |
78 | | - }), options.retryParams(), StorageImpl.EXCEPTION_HANDLER); |
79 | | - } catch (RetryHelper.RetryHelperException e) { |
80 | | - throw StorageException.translateAndThrow(e); |
81 | | - } |
| 71 | + runWithRetries(callable(new Runnable() { |
| 72 | + @Override |
| 73 | + public void run() { |
| 74 | + storageRpc.write(uploadId, buffer, 0, storageObject, position, length, false); |
| 75 | + } |
| 76 | + }), options.retryParams(), StorageImpl.EXCEPTION_HANDLER); |
82 | 77 | position += length; |
83 | 78 | limit -= length; |
84 | 79 | byte[] temp = new byte[compact ? limit : chunkSize]; |
@@ -129,16 +124,12 @@ public boolean isOpen() { |
129 | 124 | @Override |
130 | 125 | public void close() throws IOException { |
131 | 126 | if (isOpen) { |
132 | | - try { |
133 | | - runWithRetries(callable(new Runnable() { |
134 | | - @Override |
135 | | - public void run() { |
136 | | - storageRpc.write(uploadId, buffer, 0, storageObject, position, limit, true); |
137 | | - } |
138 | | - }), options.retryParams(), StorageImpl.EXCEPTION_HANDLER); |
139 | | - } catch (RetryHelper.RetryHelperException e) { |
140 | | - throw StorageException.translateAndThrow(e); |
141 | | - } |
| 127 | + runWithRetries(callable(new Runnable() { |
| 128 | + @Override |
| 129 | + public void run() { |
| 130 | + storageRpc.write(uploadId, buffer, 0, storageObject, position, limit, true); |
| 131 | + } |
| 132 | + }), options.retryParams(), StorageImpl.EXCEPTION_HANDLER); |
142 | 133 | position += buffer.length; |
143 | 134 | isOpen = false; |
144 | 135 | buffer = null; |
|
0 commit comments