You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by sb...@apache.org on 2014/05/13 17:22:55 UTC
[05/14] git commit: Fixed issue where exception terminated thread and
it wouldn't start again
Fixed issue where exception terminated thread and it wouldn't start again
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/f62afa57
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/f62afa57
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/f62afa57
Branch: refs/heads/master
Commit: f62afa57ce5ca19d639c84e89ea29f998a16fbe5
Parents: fb8f7ae
Author: mfranklin <mf...@apache.org>
Authored: Thu May 1 19:54:56 2014 -0400
Committer: mfranklin <mf...@apache.org>
Committed: Thu May 1 19:54:56 2014 -0400
----------------------------------------------------------------------
.../provider/SysomosHeartbeatStream.java | 45 +++++++++++---------
1 file changed, 26 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/f62afa57/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
index c5145fb..9cd5898 100644
--- a/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
+++ b/streams-contrib/streams-provider-sysomos/src/main/java/org/apache/streams/sysomos/provider/SysomosHeartbeatStream.java
@@ -72,29 +72,36 @@ public class SysomosHeartbeatStream implements Runnable {
}
protected QueryResult executeAPIRequest() {
- BeatApi.BeatResponse response = this.client.createRequestBuilder()
- .setHeartBeatId(heartbeatId)
- .setOffset(0)
- .setReturnSetSize(maxApiBatch).execute();
-
- LOGGER.debug("Received {} results from API query", response.getCount());
+ BeatApi.BeatResponse response = null;
+ try {
+ response = this.client.createRequestBuilder()
+ .setHeartBeatId(heartbeatId)
+ .setOffset(0)
+ .setReturnSetSize(maxApiBatch).execute();
+
+ LOGGER.debug("Received {} results from API query", response.getCount());
+ } catch (Exception e) {
+ LOGGER.warn("Error querying Sysomos API", e);
+ }
String currentId = null;
boolean matched = false;
- for(BeatApi.BeatResponse.Beat beat : response.getBeat()) {
- String docId = beat.getDocid();
- //We get documents in descending time order. This will set the id to the latest document
- if(currentId == null) {
- currentId = docId;
- }
- //We only want to process documents that we know we have not seen before
- if(lastID != null && lastID.equals(docId)) {
- matched = true;
- break;
+ if(response != null) {
+ for (BeatApi.BeatResponse.Beat beat : response.getBeat()) {
+ String docId = beat.getDocid();
+ //We get documents in descending time order. This will set the id to the latest document
+ if (currentId == null) {
+ currentId = docId;
+ }
+ //We only want to process documents that we know we have not seen before
+ if (lastID != null && lastID.equals(docId)) {
+ matched = true;
+ break;
+ }
+ StreamsDatum item = new StreamsDatum(beat, docId);
+ item.getMetadata().put("heartbeat", this.heartbeatId);
+ this.provider.enqueueItem(item);
}
- StreamsDatum item = new StreamsDatum(beat, docId);
- item.getMetadata().put("heartbeat", this.heartbeatId);
- this.provider.enqueueItem(item);
}
return new QueryResult(matched, currentId);
}