1.1 --- a/src/org/sonews/util/Purger.java Sun Aug 29 18:17:37 2010 +0200
1.2 +++ b/src/org/sonews/util/Purger.java Sun Oct 09 01:22:18 2011 +0200
1.3 @@ -15,7 +15,6 @@
1.4 * You should have received a copy of the GNU General Public License
1.5 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.6 */
1.7 -
1.8 package org.sonews.util;
1.9
1.10 import java.util.Date;
1.11 @@ -24,7 +23,6 @@
1.12 import org.sonews.config.Config;
1.13 import org.sonews.storage.Article;
1.14 import org.sonews.storage.Headers;
1.15 -import org.sonews.storage.Channel;
1.16 import org.sonews.storage.Group;
1.17 import org.sonews.storage.StorageBackendException;
1.18 import org.sonews.storage.StorageManager;
1.19 @@ -37,16 +35,14 @@
1.20 * @author Christian Lins
1.21 * @since sonews/0.5.0
1.22 */
1.23 -public class Purger extends AbstractDaemon
1.24 -{
1.25 +public class Purger extends AbstractDaemon {
1.26
1.27 /**
1.28 * Loops through all messages and deletes them if their time
1.29 * has come.
1.30 */
1.31 @Override
1.32 - public void run()
1.33 - {
1.34 + public void run() {
1.35 try {
1.36 while (isRunning()) {
1.37 purgeDeleted();
1.38 @@ -62,10 +58,9 @@
1.39 }
1.40
1.41 private void purgeDeleted()
1.42 - throws StorageBackendException
1.43 - {
1.44 - List<Channel> groups = StorageManager.current().getGroups();
1.45 - for (Channel channel : groups) {
1.46 + throws StorageBackendException {
1.47 + List<Group> groups = StorageManager.current().getGroups();
1.48 + for (Group channel : groups) {
1.49 if (!(channel instanceof Group)) {
1.50 continue;
1.51 }
1.52 @@ -89,12 +84,11 @@
1.53 }
1.54
1.55 private void purgeOutdated()
1.56 - throws InterruptedException, StorageBackendException
1.57 - {
1.58 + throws InterruptedException, StorageBackendException {
1.59 long articleMaximum =
1.60 - Config.inst().get("sonews.article.maxnum", Long.MAX_VALUE);
1.61 + Config.inst().get("sonews.article.maxnum", Long.MAX_VALUE);
1.62 long lifetime =
1.63 - Config.inst().get("sonews.article.lifetime", -1);
1.64 + Config.inst().get("sonews.article.lifetime", -1);
1.65
1.66 if (lifetime > 0 || articleMaximum < Stats.getInstance().getNumberOfNews()) {
1.67 Log.get().info("Purging old messages...");