-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
36 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 12 additions & 46 deletions
58
server/src/main/java/org/diskproject/server/threads/DataThread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,22 @@ | ||
package org.diskproject.server.threads; | ||
|
||
import org.diskproject.server.repository.DiskRepository; | ||
|
||
public class DataThread implements Runnable { | ||
DiskRepository disk; | ||
public DataThread(DiskRepository disk) { | ||
this.disk = disk; | ||
} | ||
|
||
@Override | ||
public void run() { | ||
// TODO Auto-generated method stub | ||
throw new UnsupportedOperationException("Unimplemented method 'run'"); | ||
System.out.println("[D] Running data monitor thread"); | ||
disk.queryAllGoals(); | ||
} | ||
|
||
// All of this needs to be reworked to clear caches and re run queries. | ||
/*public class DataMonitor implements Runnable { | ||
boolean stop; | ||
ScheduledFuture<?> scheduledFuture; | ||
public DataMonitor() { | ||
stop = false; | ||
scheduledFuture = monitor.scheduleWithFixedDelay(this, 0, 1, TimeUnit.DAYS); | ||
public void stop() { | ||
while (!Thread.interrupted()) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
public void run() { | ||
System.out.println("[D] Running data monitor thread"); | ||
try { | ||
Thread.sleep(5000); | ||
if (stop) { | ||
scheduledFuture.cancel(false); | ||
while (!Thread.currentThread().isInterrupted()) { | ||
Thread.currentThread().interrupt(); | ||
} | ||
} else if (!this.equals(dataThread)) { | ||
stop(); | ||
return; | ||
} else { | ||
// Re-run all hypothesis FIXME: | ||
// runAllHypotheses("admin"); | ||
} | ||
} catch (Exception e) { | ||
scheduledFuture.cancel(false); | ||
while (!Thread.interrupted()) { | ||
stop = true; | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
} | ||
public void stop() { | ||
while (!Thread.interrupted()) { | ||
stop = true; | ||
scheduledFuture.cancel(false); | ||
Thread.currentThread().interrupt(); | ||
} | ||
} | ||
}*/ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters