Clean up Segmented(ByteBuf)Journal
[controller.git] / opendaylight / md-sal / sal-akka-segmented-journal / src / main / java / org / opendaylight / controller / akka / segjournal / DataJournalV0.java
index bf1700f7f04eb64dda6751e436068a662da4e097..c5f9d7205eb3d9b7886a818c8333e268079372ee 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.base.VerifyException;
 import io.atomix.storage.journal.JournalReader;
 import io.atomix.storage.journal.JournalSerdes;
 import io.atomix.storage.journal.JournalWriter;
+import io.atomix.storage.journal.SegmentedByteBufJournal;
 import io.atomix.storage.journal.SegmentedJournal;
 import io.atomix.storage.journal.StorageLevel;
 import java.io.File;
@@ -40,13 +41,16 @@ final class DataJournalV0 extends DataJournal {
     DataJournalV0(final String persistenceId, final Histogram messageSize, final ActorSystem system,
             final StorageLevel storage, final File directory, final int maxEntrySize, final int maxSegmentSize) {
         super(persistenceId, messageSize);
-        entries = SegmentedJournal.<DataJournalEntry>builder()
-                .withStorageLevel(storage).withDirectory(directory).withName("data")
-                .withNamespace(JournalSerdes.builder()
-                    .register(new DataJournalEntrySerdes(system), FromPersistence.class, ToPersistence.class)
-                    .build())
-                .withMaxEntrySize(maxEntrySize).withMaxSegmentSize(maxSegmentSize)
-                .build();
+        entries = new SegmentedJournal<>(SegmentedByteBufJournal.builder()
+            .withDirectory(directory)
+            .withName("data")
+            .withStorageLevel(storage)
+            .withMaxEntrySize(maxEntrySize)
+            .withMaxSegmentSize(maxSegmentSize)
+            .build(),
+            JournalSerdes.builder()
+                .register(new DataJournalEntrySerdes(system), FromPersistence.class, ToPersistence.class)
+                .build().toMapper());
     }
 
     @Override