mirror of https://github.com/zlatinb/muwire
skeleton of perister service
parent
80e007c148
commit
1ac93f117a
|
@ -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() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue