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/10/13 14:13:32 UTC

[3/8] git commit: STREAMS-190 | Changed documentation for throughput

STREAMS-190 | Changed documentation for throughput


Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/0ea1c19d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/0ea1c19d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/0ea1c19d

Branch: refs/heads/master
Commit: 0ea1c19d591698bceccd034a0e5f51781dab8084
Parents: 50906ed
Author: Ryan Ebanks <ry...@gmail.com>
Authored: Wed Oct 8 14:37:48 2014 -0500
Committer: Ryan Ebanks <ry...@gmail.com>
Committed: Wed Oct 8 14:37:48 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/streams/local/queues/ThroughputQueue.java  | 6 ++++--
 .../org/apache/streams/local/queues/ThroughputQueueMXBean.java | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/0ea1c19d/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueue.java
----------------------------------------------------------------------
diff --git a/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueue.java b/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueue.java
index 2bd27a8..d2dfebb 100644
--- a/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueue.java
+++ b/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueue.java
@@ -338,8 +338,10 @@ public class ThroughputQueue<E> implements BlockingQueue<E>, ThroughputQueueMXBe
         double tp = -1.0;
         synchronized (this) {
             try {
-                this.takeCountsLock.readLock().lock();
-                tp = this.elementsRemoved / ((System.currentTimeMillis() - this.startTime) / 1000.0);
+                if(active) {
+                    this.takeCountsLock.readLock().lock();
+                    tp = this.elementsRemoved / ((System.currentTimeMillis() - this.startTime) / 1000.0);
+                }
             } finally {
                 this.takeCountsLock.readLock().unlock();
             }

http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/0ea1c19d/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueueMXBean.java
----------------------------------------------------------------------
diff --git a/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueueMXBean.java b/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueueMXBean.java
index 00d3a47..560e189 100644
--- a/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueueMXBean.java
+++ b/streams-runtimes/streams-runtime-local/src/main/java/org/apache/streams/local/queues/ThroughputQueueMXBean.java
@@ -38,8 +38,9 @@ public interface ThroughputQueueMXBean {
     public long getAdded();
 
     /**
-     * Get the the throughput of the queue measured by the time the queue has been active divided by
-     * the number of items removed from the queue.  Active time starts once the first item has been pl
+     * Get the the throughput of the queue measured by the number of items removed from the queue
+     * dived by the time the queue has been active.
+     * Active time starts once the first item has been placed on the queue
      * @return throughput of queue. items/sec, items removed / time active
      */
     public double getThroughput();