smarter way of stopping things

This commit is contained in:
Athou
2013-04-16 09:29:33 +02:00
parent 2fbd7c3837
commit b6d8072090
3 changed files with 22 additions and 12 deletions

View File

@@ -4,11 +4,13 @@ import java.util.Calendar;
import java.util.List;
import java.util.Queue;
import javax.annotation.PreDestroy;
import javax.ejb.Lock;
import javax.ejb.LockType;
import javax.ejb.Singleton;
import javax.inject.Inject;
import com.commafeed.backend.StartupBean;
import com.commafeed.backend.dao.FeedDAO;
import com.commafeed.backend.model.Feed;
import com.commafeed.backend.services.ApplicationSettingsService;
@@ -23,6 +25,9 @@ public class FeedRefreshTaskGiver {
@Inject
ApplicationSettingsService applicationSettingsService;
@Inject
StartupBean startupBean;
private Queue<Feed> queue = Lists.newLinkedList();
@Lock(LockType.WRITE)
@@ -39,4 +44,9 @@ public class FeedRefreshTaskGiver {
}
return queue.poll();
}
@PreDestroy
public void shutdown() {
startupBean.shutdown();
}
}