[
https://issues.apache.org/jira/browse/CAMEL-12880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16649755#comment-16649755
]
ASF GitHub Bot commented on CAMEL-12880:
----------------------------------------
oscerd closed pull request #2565: CAMEL-12880 : Atom consumer stops polling
URL: https://github.com/apache/camel/pull/2565
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java
b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java
index f6e9b2c3cee..5b1875a8b45 100644
---
a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java
+++
b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java
@@ -20,6 +20,7 @@
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
+import java.net.URLConnection;
import org.apache.abdera.Abdera;
import org.apache.abdera.model.Document;
@@ -53,13 +54,19 @@ public static Parser getAtomParser() {
* @throws ParseException is thrown if the parsing failed
*/
public static Document<Feed> parseDocument(String uri) throws IOException,
ParseException {
- InputStream in = new URL(uri).openStream();
+ URL feedUrl = new URL(uri);
+ URLConnection urlConn = feedUrl.openConnection();
+ urlConn.setConnectTimeout(60000);
+ urlConn.setReadTimeout(60000);
+ InputStream in = urlConn.getInputStream();
return parseInputStream(in);
}
public static Document<Feed> parseDocument(String uri, String username,
String password) throws IOException {
URL feedUrl = new URL(uri);
HttpURLConnection httpcon = (HttpURLConnection)
feedUrl.openConnection();
+ httpcon.setConnectTimeout(60000);
+ httpcon.setReadTimeout(60000);
String encoding =
Base64.encodeBase64String(username.concat(":").concat(password).getBytes());
httpcon.setRequestProperty("Authorization", "Basic " + encoding);
InputStream in = httpcon.getInputStream();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Atom consumer stops polling
> ---------------------------
>
> Key: CAMEL-12880
> URL: https://issues.apache.org/jira/browse/CAMEL-12880
> Project: Camel
> Issue Type: Bug
> Components: camel-atom
> Affects Versions: 2.22.1
> Reporter: Saravanakumar Selvaraj
> Assignee: Andrea Cosentino
> Priority: Major
>
> Camel-atom consumer stops polling for new feeds when a connection error
> occurs.
> It uses java.net.HttpURLConnection without a connection timeout value(The
> default value is 0 i.e. no timeout).
> When network error occur, connection threads hang and it causes
> ScheduledExecutorService stop polling.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)