From eb6dd48ee8a9a20889d7fcd994b8fc0d7df9ba1c Mon Sep 17 00:00:00 2001 From: tedyu Date: Mon, 21 Dec 2015 09:29:16 -0800 Subject: [PATCH] FLINK-3103 Remove synchronization in FsStateBackend#FsCheckpointStateOutputStream#close() --- .../state/filesystem/FsStateBackend.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java b/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java index a6eebf6f5d627..ed28e5ef45a1e 100644 --- a/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java +++ b/flink-runtime/src/main/java/org/apache/flink/runtime/state/filesystem/FsStateBackend.java @@ -468,22 +468,20 @@ public void flush() throws IOException { */ @Override public void close() { - synchronized (this) { - if (!closed) { - closed = true; - if (outStream != null) { + if (!closed) { + closed = true; + if (outStream != null) { + try { + outStream.close(); + fs.delete(statePath, false); + + // attempt to delete the parent (will fail and be ignored if the parent has more files) try { - outStream.close(); - fs.delete(statePath, false); - - // attempt to delete the parent (will fail and be ignored if the parent has more files) - try { - fs.delete(basePath, false); - } catch (IOException ignored) {} - } - catch (Exception e) { - LOG.warn("Cannot delete closed and discarded state stream for " + statePath, e); - } + fs.delete(basePath, false); + } catch (IOException ignored) {} + } + catch (Exception e) { + LOG.warn("Cannot delete closed and discarded state stream for " + statePath, e); } } }