/** * Creates a {@code AbstractThingSnapshotter} for a {@code ThingPersistenceActor}. * * @param persistenceActor The persistence actor to whom this snapshotter belongs. Must not be null. * @param snapshotAdapter Serializer and deserializer of snapshots. Must not be null. * @param snapshotDeleteOld Whether old and unprotected snapshots should be deleted. * @param eventsDeleteOld Whether events before a successfully saved snapshot should be deleted. * @param log The logger. If null, nothing is logged. * @param snapshotInterval How long to wait between scheduled maintenance snapshots. */ protected ThingSnapshotter(final ThingPersistenceActor persistenceActor, final SnapshotAdapter<ThingWithSnapshotTag> snapshotAdapter, final boolean snapshotDeleteOld, final boolean eventsDeleteOld, @Nullable final DiagnosticLoggingAdapter log, @Nullable final java.time.Duration snapshotInterval) { this(persistenceActor, snapshotAdapter, snapshotDeleteOld, eventsDeleteOld, log, snapshotInterval != null ? Duration.fromNanos(snapshotInterval.toNanos()) : null, // save-snapshot timeout Duration.create(50000, TimeUnit.MILLISECONDS), // load-snapshot timeout Duration.create(3000, TimeUnit.MILLISECONDS), Persistence.get(persistenceActor.getContext().system()) .snapshotStoreFor(persistenceActor.snapshotPluginId(), ConfigFactory.empty())); }
/** * Creates a {@code AbstractThingSnapshotter} for a {@code ThingPersistenceActor}. * * @param persistenceActor The persistence actor to whom this snapshotter belongs. Must not be null. * @param snapshotAdapter Serializer and deserializer of snapshots. Must not be null. * @param snapshotDeleteOld Whether old and unprotected snapshots should be deleted. * @param eventsDeleteOld Whether events before a successfully saved snapshot should be deleted. * @param log The logger. If null, nothing is logged. * @param snapshotInterval How long to wait between scheduled maintenance snapshots. */ protected ThingSnapshotter(final ThingPersistenceActor persistenceActor, final SnapshotAdapter<ThingWithSnapshotTag> snapshotAdapter, final boolean snapshotDeleteOld, final boolean eventsDeleteOld, @Nullable final DiagnosticLoggingAdapter log, @Nullable final java.time.Duration snapshotInterval) { this(persistenceActor, snapshotAdapter, snapshotDeleteOld, eventsDeleteOld, log, snapshotInterval != null ? Duration.fromNanos(snapshotInterval.toNanos()) : null, // save-snapshot timeout Duration.create(500, TimeUnit.MILLISECONDS), // load-snapshot timeout Duration.create(3000, TimeUnit.MILLISECONDS), Persistence.get(persistenceActor.getContext().system()) .snapshotStoreFor(persistenceActor.snapshotPluginId(), ConfigFactory.empty())); }