X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fpersistence%2FLocalSnapshotStore.java;fp=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fpersistence%2FLocalSnapshotStore.java;h=e08fec2e899e6759b64c0d08c735ac8bd52f8a09;hb=1a33f8ff73b05cf4d21f0cc989471ec68b14b145;hp=62b0cf5bfd061867da72cd4084eb8eec86d72821;hpb=728a8db811f7a257a0b69243cbf76bb5ccf69658;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java index 62b0cf5bfd..e08fec2e89 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java @@ -20,6 +20,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.io.ByteStreams; import com.typesafe.config.Config; import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -137,7 +138,7 @@ public class LocalSnapshotStore extends SnapshotStore { private Object deserialize(final File file) throws IOException { return JavaSerializer.currentSystem().withValue((ExtendedActorSystem) context().system(), (Callable) () -> { - try (ObjectInputStream in = new ObjectInputStream(new FileInputStream(file))) { + try (ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(new FileInputStream(file)))) { return in.readObject(); } catch (ClassNotFoundException e) { throw new IOException("Error loading snapshot file " + file, e); @@ -175,7 +176,7 @@ public class LocalSnapshotStore extends SnapshotStore { LOG.debug("Saving to temp file: {}", temp); - try (ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(temp))) { + try (ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(temp)))) { out.writeObject(snapshot); } catch (IOException e) { LOG.error("Error saving snapshot file {}. Deleting file..", temp, e);