You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by fh...@apache.org on 2016/04/21 01:37:56 UTC
[3/3] flink git commit: [FLINK-3781] Ensure BlobClient is closed.
[FLINK-3781] Ensure BlobClient is closed.
This closes #1908
Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/a43bade0
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/a43bade0
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/a43bade0
Branch: refs/heads/master
Commit: a43bade0d87d373ff236152d13d8d56e17220605
Parents: 605b6d8
Author: Chenguang He <ga...@gmail.com>
Authored: Mon Apr 18 13:52:45 2016 -0500
Committer: Fabian Hueske <fh...@apache.org>
Committed: Wed Apr 20 23:00:56 2016 +0200
----------------------------------------------------------------------
.../org/apache/flink/runtime/blob/BlobCache.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flink/blob/a43bade0/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java b/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java
index 4d33364..bb0aacb 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/blob/BlobCache.java
@@ -71,13 +71,13 @@ public final class BlobCache implements BlobService {
// configure the number of fetch retries
final int fetchRetries = configuration.getInteger(
- ConfigConstants.BLOB_FETCH_RETRIES_KEY, ConfigConstants.DEFAULT_BLOB_FETCH_RETRIES);
+ ConfigConstants.BLOB_FETCH_RETRIES_KEY, ConfigConstants.DEFAULT_BLOB_FETCH_RETRIES);
if (fetchRetries >= 0) {
this.numFetchRetries = fetchRetries;
}
else {
LOG.warn("Invalid value for {}. System will attempt no retires on failed fetches of BLOBs.",
- ConfigConstants.BLOB_FETCH_RETRIES_KEY);
+ ConfigConstants.BLOB_FETCH_RETRIES_KEY);
this.numFetchRetries = 0;
}
@@ -89,7 +89,7 @@ public final class BlobCache implements BlobService {
* Returns the URL for the BLOB with the given key. The method will first attempt to serve
* the BLOB from its local cache. If the BLOB is not in the cache, the method will try to download it
* from this cache's BLOB server.
- *
+ *
* @param requiredBlob The key of the desired BLOB.
* @return URL referring to the local storage location of the BLOB.
* @throws IOException Thrown if an I/O error occurs while downloading the BLOBs from the BLOB server.
@@ -163,7 +163,7 @@ public final class BlobCache implements BlobService {
}
catch (IOException e) {
String message = "Failed to fetch BLOB " + requiredBlob + " from " + serverAddress +
- " and store it under " + localJarFile.getAbsolutePath();
+ " and store it under " + localJarFile.getAbsolutePath();
if (attempt < numFetchRetries) {
attempt++;
if (LOG.isDebugEnabled()) {
@@ -200,10 +200,14 @@ public final class BlobCache implements BlobService {
* @param key referring to the file to be deleted
*/
public void deleteGlobal(BlobKey key) throws IOException {
- delete(key);
BlobClient bc = createClient();
- bc.delete(key);
- bc.close();
+ try {
+ delete(key);
+ bc.delete(key);
+ }
+ finally {
+ bc.close();
+ }
}
@Override