forked from Archives/Athou_commafeed
small tweaks
This commit is contained in:
@@ -5,6 +5,8 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import javax.ejb.ActivationConfigProperty;
|
import javax.ejb.ActivationConfigProperty;
|
||||||
import javax.ejb.MessageDriven;
|
import javax.ejb.MessageDriven;
|
||||||
|
import javax.ejb.TransactionAttribute;
|
||||||
|
import javax.ejb.TransactionAttributeType;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.jms.JMSException;
|
import javax.jms.JMSException;
|
||||||
import javax.jms.Message;
|
import javax.jms.Message;
|
||||||
@@ -22,6 +24,7 @@ import com.commafeed.backend.services.FeedUpdateService;
|
|||||||
@MessageDriven(name = "FeedRefreshUpdater", activationConfig = {
|
@MessageDriven(name = "FeedRefreshUpdater", activationConfig = {
|
||||||
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
|
@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
|
||||||
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/refreshQueue") })
|
@ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/refreshQueue") })
|
||||||
|
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
|
||||||
public class FeedRefreshUpdater implements MessageListener {
|
public class FeedRefreshUpdater implements MessageListener {
|
||||||
|
|
||||||
private static Logger log = LoggerFactory
|
private static Logger log = LoggerFactory
|
||||||
@@ -44,8 +47,9 @@ public class FeedRefreshUpdater implements MessageListener {
|
|||||||
if (task.getEntries() != null) {
|
if (task.getEntries() != null) {
|
||||||
feedUpdateService.updateEntries(task.getFeed(),
|
feedUpdateService.updateEntries(task.getFeed(),
|
||||||
task.getEntries());
|
task.getEntries());
|
||||||
|
} else {
|
||||||
|
feedDAO.update(task.getFeed());
|
||||||
}
|
}
|
||||||
feedDAO.update(task.getFeed());
|
|
||||||
} catch (JMSException e) {
|
} catch (JMSException e) {
|
||||||
log.error(e.getMessage(), 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.mutable.MutableBoolean;
|
||||||
import org.apache.commons.lang.time.DateUtils;
|
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.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -102,7 +104,12 @@ public class FeedRefreshWorker {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
message = "Unable to refresh feed " + feed.getUrl() + " : "
|
message = "Unable to refresh feed " + feed.getUrl() + " : "
|
||||||
+ e.getMessage();
|
+ 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;
|
errorCount = feed.getErrorCount() + 1;
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Calendar;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.ejb.Stateless;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
@@ -22,6 +23,7 @@ import com.commafeed.backend.model.FeedEntryStatus;
|
|||||||
import com.commafeed.backend.model.FeedSubscription;
|
import com.commafeed.backend.model.FeedSubscription;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
@Stateless
|
||||||
public class FeedUpdateService {
|
public class FeedUpdateService {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -85,6 +87,7 @@ public class FeedUpdateService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
feedDAO.update(feed);
|
||||||
feedEntryDAO.saveOrUpdate(entryUpdateList);
|
feedEntryDAO.saveOrUpdate(entryUpdateList);
|
||||||
feedEntryStatusDAO.saveOrUpdate(statusUpdateList);
|
feedEntryStatusDAO.saveOrUpdate(statusUpdateList);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user