You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by mf...@apache.org on 2014/06/17 21:45:51 UTC
[08/15] git commit: STREAMS-83 | Updated rss provider with running
method
STREAMS-83 | Updated rss provider with running method
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/ef483d47
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/ef483d47
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/ef483d47
Branch: refs/heads/master
Commit: ef483d4732be299b8c651caea9ef94a1e8bb4cdc
Parents: 1327b3a
Author: mfranklin <mf...@apache.org>
Authored: Thu Jun 12 12:22:46 2014 -0500
Committer: mfranklin <mf...@apache.org>
Committed: Thu Jun 12 12:22:46 2014 -0500
----------------------------------------------------------------------
.../apache/streams/rss/provider/RssStreamProvider.java | 11 +++++++++++
1 file changed, 11 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/ef483d47/streams-contrib/streams-provider-rss/src/main/java/org/apache/streams/rss/provider/RssStreamProvider.java
----------------------------------------------------------------------
diff --git a/streams-contrib/streams-provider-rss/src/main/java/org/apache/streams/rss/provider/RssStreamProvider.java b/streams-contrib/streams-provider-rss/src/main/java/org/apache/streams/rss/provider/RssStreamProvider.java
index c9bbe49..02ed1db 100644
--- a/streams-contrib/streams-provider-rss/src/main/java/org/apache/streams/rss/provider/RssStreamProvider.java
+++ b/streams-contrib/streams-provider-rss/src/main/java/org/apache/streams/rss/provider/RssStreamProvider.java
@@ -45,6 +45,7 @@ import java.net.URL;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Created by sblackmon on 12/10/13.
@@ -77,6 +78,8 @@ public class RssStreamProvider implements StreamsProvider {
protected List<SyndFeed> feeds;
+ protected final AtomicBoolean running = new AtomicBoolean();
+
private static ExecutorService newFixedThreadPoolWithQueueSize(int nThreads, int queueSize) {
return new ThreadPoolExecutor(nThreads, nThreads,
5000L, TimeUnit.MILLISECONDS,
@@ -121,12 +124,15 @@ public class RssStreamProvider implements StreamsProvider {
for( int i = 0; i < ((config.getFeeds().size() / 5) + 1); i++ )
executor.submit(new RssEventProcessor(inQueue, providerQueue, klass));
+ running.set(true);
+
}
public void stop() {
for (int i = 0; i < ((config.getFeeds().size() / 5) + 1); i++) {
inQueue.add(RssEventProcessor.TERMINATE);
}
+ running.set(false);
}
public Queue<StreamsDatum> getProviderQueue() {
@@ -151,6 +157,11 @@ public class RssStreamProvider implements StreamsProvider {
}
@Override
+ public boolean isRunning() {
+ return running.get();
+ }
+
+ @Override
public void prepare(Object configurationObject) {
}