Writeback flush on shutdown

This commit is contained in:
2024-06-21 15:42:11 +02:00
parent 49ffe29940
commit caf4ad6373
2 changed files with 10 additions and 2 deletions

View File

@@ -1,10 +1,12 @@
package com.usatiuk.dhfs.storage.objects.jrepository;
import com.usatiuk.dhfs.storage.objects.repository.persistence.ObjectPersistentStore;
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.scheduler.Scheduled;
import io.smallrye.common.annotation.Blocking;
import io.smallrye.common.annotation.RunOnVirtualThread;
import jakarta.annotation.Priority;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import jakarta.inject.Inject;
import org.apache.commons.lang3.SerializationUtils;
@@ -18,9 +20,13 @@ public class JObjectWriteback {
private final LinkedHashMap<String, JObject<?>> _objects = new LinkedHashMap<>();
void shutdown(@Observes @Priority(10) ShutdownEvent event) {
flush();
}
@Scheduled(every = "1s", concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
@RunOnVirtualThread
public void write() {
public void flush() {
while (true) {
JObject<?> obj;
synchronized (this) {

View File

@@ -3,6 +3,8 @@ dhfs.objects.persistence.files.root=${HOME}/dhfs_data/dhfs_root
dhfs.objects.distributed.root=${HOME}/dhfs_data/dhfs_root_d
dhfs.fuse.root=${HOME}/dhfs_data/dhfs_fuse_root
quarkus.quartz.shutdown-wait-time=31D
grpc.client.greeting-service.max-inbound-message-size=9155241000
grpc.client.greeting-service.package-max-inbound-message-size=9155241000
grpc.client.greeting-service.server.max-inbound-message-size=9155241000