Don't call stopped.get() outside the lock.

This commit is contained in:
akwizgran
2011-09-27 16:26:55 +01:00
parent a40c081815
commit dea77b22d7

View File

@@ -29,11 +29,12 @@ class DatabaseCleanerImpl implements DatabaseCleaner, Runnable {
public void run() {
try {
while(!stopped.get()) {
while(true) {
if(callback.shouldCheckFreeSpace()) {
callback.checkFreeSpaceAndClean();
} else {
synchronized(stopped) {
if(stopped.get()) break;
try {
stopped.wait(msBetweenSweeps);
} catch(InterruptedException ignored) {}