Repository: storm
Updated Branches:
  refs/heads/master 946042124 -> efe131d20


fix some comment typos, add convenience methods for checking if tuple is tick 
or heartbeat tuple to match python version


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/e48b2848
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/e48b2848
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/e48b2848

Branch: refs/heads/master
Commit: e48b28483fe5874a8245b782581d2d513471a2f3
Parents: 0cade64
Author: David Luu <[email protected]>
Authored: Thu Apr 28 18:33:47 2016 -0700
Committer: David Luu <[email protected]>
Committed: Thu Apr 28 18:33:47 2016 -0700

----------------------------------------------------------------------
 .../src/main/resources/resources/storm.js          | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/e48b2848/storm-multilang/javascript/src/main/resources/resources/storm.js
----------------------------------------------------------------------
diff --git a/storm-multilang/javascript/src/main/resources/resources/storm.js 
b/storm-multilang/javascript/src/main/resources/resources/storm.js
index dc6efc1..c8462ba 100755
--- a/storm-multilang/javascript/src/main/resources/resources/storm.js
+++ b/storm-multilang/javascript/src/main/resources/resources/storm.js
@@ -199,7 +199,7 @@ Storm.prototype.emitDirect = function(commandDetails) {
 
 /**
  * Initialize storm component according to the configuration received.
- * @param conf configuration object accrding to storm protocol.
+ * @param conf configuration object according to storm protocol.
  * @param context context object according to storm protocol.
  * @param done callback. Call this method when finished initializing.
  */
@@ -221,10 +221,18 @@ function Tuple(id, component, stream, task, values) {
     this.values = values;
 }
 
+Tuple.prototype.isTickTuple = function(){
+  return this.task === -1 && this.stream === "__tick";
+}
+
+Tuple.prototype.isHeartbeatTuple = function(){
+  return this.task === -1 && this.stream === "__heartbeat";
+}
+
 /**
  * Base class for storm bolt.
  * To create a bolt implement 'process' method.
- * You may also implement initialize method to
+ * You may also implement initialize method too
  */
 function BasicBolt() {
     Storm.call(this);
@@ -262,7 +270,7 @@ BasicBolt.prototype.handleNewCommand = function(command) {
     var self = this;
     var tup = new Tuple(command["id"], command["comp"], command["stream"], 
command["task"], command["tuple"]);
 
-    if (tup.task === -1 && tup.stream === "__heartbeat") {
+    if (tup.isHeartbeatTuple()) {
         self.sync();
         return;
     }
@@ -293,7 +301,6 @@ BasicBolt.prototype.fail = function(tup, err) {
     this.sendMsgToParent({"command": "fail", "id": tup.id});
 }
 
-
 /**
  * Base class for storm spout.
  * To create a spout implement the following methods: nextTuple, ack and fail 
(nextTuple - mandatory, ack and fail
@@ -370,4 +377,4 @@ Spout.prototype.__emit = function(commandDetails) {
 }
 
 module.exports.BasicBolt = BasicBolt;
-module.exports.Spout = Spout;
\ No newline at end of file
+module.exports.Spout = Spout;

Reply via email to