mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
small tweaks
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.Collection;
|
||||
|
||||
import javax.ejb.ActivationConfigProperty;
|
||||
import javax.ejb.MessageDriven;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.ejb.TransactionAttributeType;
|
||||
import javax.inject.Inject;
|
||||
import javax.jms.JMSException;
|
||||
import javax.jms.Message;
|
||||
@@ -22,6 +24,7 @@ import com.commafeed.backend.services.FeedUpdateService;
|
||||
@MessageDriven(name = "FeedRefreshUpdater", activationConfig = {
|
||||
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
|
||||
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/refreshQueue") })
|
||||
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
|
||||
public class FeedRefreshUpdater implements MessageListener {
|
||||
|
||||
private static Logger log = LoggerFactory
|
||||
@@ -44,8 +47,9 @@ public class FeedRefreshUpdater implements MessageListener {
|
||||
if (task.getEntries() != null) {
|
||||
feedUpdateService.updateEntries(task.getFeed(),
|
||||
task.getEntries());
|
||||
} else {
|
||||
feedDAO.update(task.getFeed());
|
||||
}
|
||||
feedDAO.update(task.getFeed());
|
||||
} catch (JMSException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import javax.transaction.SystemException;
|
||||
|
||||
import org.apache.commons.lang.mutable.MutableBoolean;
|
||||
import org.apache.commons.lang.time.DateUtils;
|
||||
import org.apache.http.client.HttpResponseException;
|
||||
import org.apache.http.conn.ConnectTimeoutException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -102,7 +104,12 @@ public class FeedRefreshWorker {
|
||||
} catch (Exception e) {
|
||||
message = "Unable to refresh feed " + feed.getUrl() + " : "
|
||||
+ e.getMessage();
|
||||
log.info(e.getClass().getName() + " " + message);
|
||||
if (e instanceof HttpResponseException
|
||||
|| e instanceof ConnectTimeoutException) {
|
||||
log.debug(e.getClass().getName() + " " + message);
|
||||
} else {
|
||||
log.info(e.getClass().getName() + " " + message);
|
||||
}
|
||||
|
||||
errorCount = feed.getErrorCount() + 1;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
@@ -22,6 +23,7 @@ import com.commafeed.backend.model.FeedEntryStatus;
|
||||
import com.commafeed.backend.model.FeedSubscription;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@Stateless
|
||||
public class FeedUpdateService {
|
||||
|
||||
@Inject
|
||||
@@ -85,6 +87,7 @@ public class FeedUpdateService {
|
||||
}
|
||||
}
|
||||
|
||||
feedDAO.update(feed);
|
||||
feedEntryDAO.saveOrUpdate(entryUpdateList);
|
||||
feedEntryStatusDAO.saveOrUpdate(statusUpdateList);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user