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;
private Object deserialize(final File file) throws IOException {
return JavaSerializer.currentSystem().withValue((ExtendedActorSystem) context().system(),
(Callable<Object>) () -> {
- 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);
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);