From 1ac93f117a78dd32055eabdf0b46c935a594ff81 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Fri, 20 Jul 2018 03:27:01 +0100 Subject: [PATCH] skeleton of perister service --- .../muwire/core/files/PersisterService.groovy | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 core/src/main/groovy/com/muwire/core/files/PersisterService.groovy diff --git a/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy b/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy new file mode 100644 index 00000000..78cfd146 --- /dev/null +++ b/core/src/main/groovy/com/muwire/core/files/PersisterService.groovy @@ -0,0 +1,29 @@ +package com.muwire.core.files + +class PersisterService { + + final File location + final def listener + final int interval + final Timer timer + + PersisterService(File location, def listener, int interval) { + this.location = location + this.listener = listener + this.interval = interval + timer = new Timer("file persister", true) + } + + void start() { + timer.schedule({load()} as TimerTask, 1000) + } + + private void load() { + // TODO: load shared files from location + timer.schedule({processEvents()} as TimerTask, 0, interval) + } + + private void processEvents() { + + } +}