mirror of
https://github.com/usatiuk/dhfs.git
synced 2025-10-29 04:57:48 +01:00
Writeback flush on shutdown
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user