org/sonews/feed/PushFeeder.java
changeset 27 d879bab39600
parent 15 f2293e8566f5
     1.1 --- a/org/sonews/feed/PushFeeder.java	Thu Aug 20 18:41:21 2009 +0200
     1.2 +++ b/org/sonews/feed/PushFeeder.java	Tue Apr 27 22:11:30 2010 +0200
     1.3 @@ -19,9 +19,13 @@
     1.4  package org.sonews.feed;
     1.5  
     1.6  import java.io.IOException;
     1.7 +import java.util.List;
     1.8  import java.util.concurrent.ConcurrentLinkedQueue;
     1.9 +import org.sonews.daemon.AbstractDaemon;
    1.10  import org.sonews.storage.Article;
    1.11  import org.sonews.storage.Headers;
    1.12 +import org.sonews.storage.StorageBackendException;
    1.13 +import org.sonews.storage.StorageManager;
    1.14  import org.sonews.util.Log;
    1.15  import org.sonews.util.io.ArticleWriter;
    1.16  
    1.17 @@ -31,7 +35,7 @@
    1.18   * @author Christian Lins
    1.19   * @since sonews/0.5.0
    1.20   */
    1.21 -class PushFeeder extends AbstractFeeder
    1.22 +class PushFeeder extends AbstractDaemon
    1.23  {
    1.24    
    1.25    private ConcurrentLinkedQueue<Article> articleQueue = 
    1.26 @@ -49,10 +53,13 @@
    1.27            this.wait();
    1.28          }
    1.29          
    1.30 +        List<Subscription> subscriptions = StorageManager.current()
    1.31 +          .getSubscriptions(FeedManager.TYPE_PUSH);
    1.32 +
    1.33          Article  article = this.articleQueue.poll();
    1.34          String[] groups  = article.getHeader(Headers.NEWSGROUPS)[0].split(",");
    1.35          Log.get().info("PushFeed: " + article.getMessageID());
    1.36 -        for(Subscription sub : this.subscriptions)
    1.37 +        for(Subscription sub : subscriptions)
    1.38          {
    1.39            // Circle check
    1.40            if(article.getHeader(Headers.PATH)[0].contains(sub.getHost()))
    1.41 @@ -88,6 +95,10 @@
    1.42            }
    1.43          }
    1.44        }
    1.45 +      catch(StorageBackendException ex)
    1.46 +      {
    1.47 +        Log.get().severe(ex.toString());
    1.48 +      }
    1.49        catch(InterruptedException ex)
    1.50        {
    1.51          Log.get().warning("PushFeeder interrupted: " + ex);