You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2018/04/26 20:33:31 UTC

[40/63] [abbrv] storm git commit: Fixing stylecheck problems with storm-starter

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountAggBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountAggBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountAggBolt.java
index fafdbcc..9db1dd6 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountAggBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountAggBolt.java
@@ -1,23 +1,20 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.bolt;
 
-import org.apache.storm.Config;
+import java.util.HashMap;
+import java.util.Map;
+import org.apache.log4j.Logger;
 import org.apache.storm.task.OutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.OutputFieldsDeclarer;
@@ -25,52 +22,45 @@ import org.apache.storm.topology.base.BaseRichBolt;
 import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Tuple;
 import org.apache.storm.tuple.Values;
-import org.apache.log4j.Logger;
-import org.apache.storm.starter.tools.NthLastModifiedTimeTracker;
-import org.apache.storm.starter.tools.SlidingWindowCounter;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
 
 /**
  * This bolt aggregates counts from multiple upstream bolts.
  */
 public class RollingCountAggBolt extends BaseRichBolt {
-  private static final long serialVersionUID = 5537727428628598519L;
-  private static final Logger LOG = Logger.getLogger(RollingCountAggBolt.class);
-  //Mapping of key->upstreamBolt->count
-  private Map<Object, Map<Integer, Long>> counts = new HashMap<Object, Map<Integer, Long>>();
-  private OutputCollector collector;
-
+    private static final long serialVersionUID = 5537727428628598519L;
+    private static final Logger LOG = Logger.getLogger(RollingCountAggBolt.class);
+    //Mapping of key->upstreamBolt->count
+    private Map<Object, Map<Integer, Long>> counts = new HashMap<Object, Map<Integer, Long>>();
+    private OutputCollector collector;
 
-  @Override
-  public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
-    this.collector = collector;
-  }
 
-  @Override
-  public void execute(Tuple tuple) {
-    Object obj = tuple.getValue(0);
-    long count = tuple.getLong(1);
-    int source = tuple.getSourceTask();
-    Map<Integer, Long> subCounts = counts.get(obj);
-    if (subCounts == null) {
-      subCounts = new HashMap<Integer, Long>();
-      counts.put(obj, subCounts);
+    @Override
+    public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
+        this.collector = collector;
     }
-    //Update the current count for this object
-    subCounts.put(source, count);
-    //Output the sum of all the known counts so for this key
-    long sum = 0;
-    for (Long val: subCounts.values()) {
-      sum += val;
+
+    @Override
+    public void execute(Tuple tuple) {
+        Object obj = tuple.getValue(0);
+        long count = tuple.getLong(1);
+        int source = tuple.getSourceTask();
+        Map<Integer, Long> subCounts = counts.get(obj);
+        if (subCounts == null) {
+            subCounts = new HashMap<Integer, Long>();
+            counts.put(obj, subCounts);
+        }
+        //Update the current count for this object
+        subCounts.put(source, count);
+        //Output the sum of all the known counts so for this key
+        long sum = 0;
+        for (Long val : subCounts.values()) {
+            sum += val;
+        }
+        collector.emit(new Values(obj, sum));
     }
-    collector.emit(new Values(obj, sum));
-  }
 
-  @Override
-  public void declareOutputFields(OutputFieldsDeclarer declarer) {
-    declarer.declare(new Fields("obj", "count"));
-  }
+    @Override
+    public void declareOutputFields(OutputFieldsDeclarer declarer) {
+        declarer.declare(new Fields("obj", "count"));
+    }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountBolt.java
index b7ea55e..0e5cef5 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/RollingCountBolt.java
@@ -1,23 +1,24 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.bolt;
 
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.apache.log4j.Logger;
 import org.apache.storm.Config;
+import org.apache.storm.starter.tools.NthLastModifiedTimeTracker;
+import org.apache.storm.starter.tools.SlidingWindowCounter;
 import org.apache.storm.task.OutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.OutputFieldsDeclarer;
@@ -26,13 +27,6 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Tuple;
 import org.apache.storm.tuple.Values;
 import org.apache.storm.utils.TupleUtils;
-import org.apache.log4j.Logger;
-import org.apache.storm.starter.tools.NthLastModifiedTimeTracker;
-import org.apache.storm.starter.tools.SlidingWindowCounter;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
 
 /**
  * This bolt performs rolling counts of incoming objects, i.e. sliding window based counting.
@@ -55,87 +49,86 @@ import java.util.Map.Entry;
  */
 public class RollingCountBolt extends BaseRichBolt {
 
-  private static final long serialVersionUID = 5537727428628598519L;
-  private static final Logger LOG = Logger.getLogger(RollingCountBolt.class);
-  private static final int NUM_WINDOW_CHUNKS = 5;
-  private static final int DEFAULT_SLIDING_WINDOW_IN_SECONDS = NUM_WINDOW_CHUNKS * 60;
-  private static final int DEFAULT_EMIT_FREQUENCY_IN_SECONDS = DEFAULT_SLIDING_WINDOW_IN_SECONDS / NUM_WINDOW_CHUNKS;
-  private static final String WINDOW_LENGTH_WARNING_TEMPLATE =
-      "Actual window length is %d seconds when it should be %d seconds"
-          + " (you can safely ignore this warning during the startup phase)";
+    private static final long serialVersionUID = 5537727428628598519L;
+    private static final Logger LOG = Logger.getLogger(RollingCountBolt.class);
+    private static final int NUM_WINDOW_CHUNKS = 5;
+    private static final int DEFAULT_SLIDING_WINDOW_IN_SECONDS = NUM_WINDOW_CHUNKS * 60;
+    private static final int DEFAULT_EMIT_FREQUENCY_IN_SECONDS = DEFAULT_SLIDING_WINDOW_IN_SECONDS / NUM_WINDOW_CHUNKS;
+    private static final String WINDOW_LENGTH_WARNING_TEMPLATE =
+        "Actual window length is %d seconds when it should be %d seconds"
+        + " (you can safely ignore this warning during the startup phase)";
 
-  private final SlidingWindowCounter<Object> counter;
-  private final int windowLengthInSeconds;
-  private final int emitFrequencyInSeconds;
-  private OutputCollector collector;
-  private NthLastModifiedTimeTracker lastModifiedTracker;
+    private final SlidingWindowCounter<Object> counter;
+    private final int windowLengthInSeconds;
+    private final int emitFrequencyInSeconds;
+    private OutputCollector collector;
+    private NthLastModifiedTimeTracker lastModifiedTracker;
 
-  public RollingCountBolt() {
-    this(DEFAULT_SLIDING_WINDOW_IN_SECONDS, DEFAULT_EMIT_FREQUENCY_IN_SECONDS);
-  }
-
-  public RollingCountBolt(int windowLengthInSeconds, int emitFrequencyInSeconds) {
-    this.windowLengthInSeconds = windowLengthInSeconds;
-    this.emitFrequencyInSeconds = emitFrequencyInSeconds;
-    counter = new SlidingWindowCounter<Object>(deriveNumWindowChunksFrom(this.windowLengthInSeconds,
-        this.emitFrequencyInSeconds));
-  }
+    public RollingCountBolt() {
+        this(DEFAULT_SLIDING_WINDOW_IN_SECONDS, DEFAULT_EMIT_FREQUENCY_IN_SECONDS);
+    }
 
-  private int deriveNumWindowChunksFrom(int windowLengthInSeconds, int windowUpdateFrequencyInSeconds) {
-    return windowLengthInSeconds / windowUpdateFrequencyInSeconds;
-  }
+    public RollingCountBolt(int windowLengthInSeconds, int emitFrequencyInSeconds) {
+        this.windowLengthInSeconds = windowLengthInSeconds;
+        this.emitFrequencyInSeconds = emitFrequencyInSeconds;
+        counter = new SlidingWindowCounter<Object>(deriveNumWindowChunksFrom(this.windowLengthInSeconds,
+                                                                             this.emitFrequencyInSeconds));
+    }
 
-  @Override
-  public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
-    this.collector = collector;
-    lastModifiedTracker = new NthLastModifiedTimeTracker(deriveNumWindowChunksFrom(this.windowLengthInSeconds,
-        this.emitFrequencyInSeconds));
-  }
+    private int deriveNumWindowChunksFrom(int windowLengthInSeconds, int windowUpdateFrequencyInSeconds) {
+        return windowLengthInSeconds / windowUpdateFrequencyInSeconds;
+    }
 
-  @Override
-  public void execute(Tuple tuple) {
-    if (TupleUtils.isTick(tuple)) {
-      LOG.debug("Received tick tuple, triggering emit of current window counts");
-      emitCurrentWindowCounts();
+    @Override
+    public void prepare(Map<String, Object> topoConf, TopologyContext context, OutputCollector collector) {
+        this.collector = collector;
+        lastModifiedTracker = new NthLastModifiedTimeTracker(deriveNumWindowChunksFrom(this.windowLengthInSeconds,
+                                                                                       this.emitFrequencyInSeconds));
     }
-    else {
-      countObjAndAck(tuple);
+
+    @Override
+    public void execute(Tuple tuple) {
+        if (TupleUtils.isTick(tuple)) {
+            LOG.debug("Received tick tuple, triggering emit of current window counts");
+            emitCurrentWindowCounts();
+        } else {
+            countObjAndAck(tuple);
+        }
     }
-  }
 
-  private void emitCurrentWindowCounts() {
-    Map<Object, Long> counts = counter.getCountsThenAdvanceWindow();
-    int actualWindowLengthInSeconds = lastModifiedTracker.secondsSinceOldestModification();
-    lastModifiedTracker.markAsModified();
-    if (actualWindowLengthInSeconds != windowLengthInSeconds) {
-      LOG.warn(String.format(WINDOW_LENGTH_WARNING_TEMPLATE, actualWindowLengthInSeconds, windowLengthInSeconds));
+    private void emitCurrentWindowCounts() {
+        Map<Object, Long> counts = counter.getCountsThenAdvanceWindow();
+        int actualWindowLengthInSeconds = lastModifiedTracker.secondsSinceOldestModification();
+        lastModifiedTracker.markAsModified();
+        if (actualWindowLengthInSeconds != windowLengthInSeconds) {
+            LOG.warn(String.format(WINDOW_LENGTH_WARNING_TEMPLATE, actualWindowLengthInSeconds, windowLengthInSeconds));
+        }
+        emit(counts, actualWindowLengthInSeconds);
     }
-    emit(counts, actualWindowLengthInSeconds);
-  }
 
-  private void emit(Map<Object, Long> counts, int actualWindowLengthInSeconds) {
-    for (Entry<Object, Long> entry : counts.entrySet()) {
-      Object obj = entry.getKey();
-      Long count = entry.getValue();
-      collector.emit(new Values(obj, count, actualWindowLengthInSeconds));
+    private void emit(Map<Object, Long> counts, int actualWindowLengthInSeconds) {
+        for (Entry<Object, Long> entry : counts.entrySet()) {
+            Object obj = entry.getKey();
+            Long count = entry.getValue();
+            collector.emit(new Values(obj, count, actualWindowLengthInSeconds));
+        }
     }
-  }
 
-  private void countObjAndAck(Tuple tuple) {
-    Object obj = tuple.getValue(0);
-    counter.incrementCount(obj);
-    collector.ack(tuple);
-  }
+    private void countObjAndAck(Tuple tuple) {
+        Object obj = tuple.getValue(0);
+        counter.incrementCount(obj);
+        collector.ack(tuple);
+    }
 
-  @Override
-  public void declareOutputFields(OutputFieldsDeclarer declarer) {
-    declarer.declare(new Fields("obj", "count", "actualWindowLengthInSeconds"));
-  }
+    @Override
+    public void declareOutputFields(OutputFieldsDeclarer declarer) {
+        declarer.declare(new Fields("obj", "count", "actualWindowLengthInSeconds"));
+    }
 
-  @Override
-  public Map<String, Object> getComponentConfiguration() {
-    Map<String, Object> conf = new HashMap<String, Object>();
-    conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, emitFrequencyInSeconds);
-    return conf;
-  }
+    @Override
+    public Map<String, Object> getComponentConfiguration() {
+        Map<String, Object> conf = new HashMap<String, Object>();
+        conf.put(Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS, emitFrequencyInSeconds);
+        return conf;
+    }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SingleJoinBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SingleJoinBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SingleJoinBolt.java
index aaed340..00a2ab7 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SingleJoinBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SingleJoinBolt.java
@@ -1,22 +1,23 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.bolt;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import org.apache.storm.Config;
 import org.apache.storm.generated.GlobalStreamId;
 import org.apache.storm.task.OutputCollector;
@@ -27,92 +28,92 @@ import org.apache.storm.tuple.Fields;
 import org.apache.storm.tuple.Tuple;
 import org.apache.storm.utils.TimeCacheMap;
 
-import java.util.*;
-
 /** Example of a simple custom bolt for joining two streams
  *  NOTE: Prefer to use the built-in JoinBolt wherever applicable
  */
 
 public class SingleJoinBolt extends BaseRichBolt {
-  OutputCollector _collector;
-  Fields _idFields;
-  Fields _outFields;
-  int _numSources;
-  TimeCacheMap<List<Object>, Map<GlobalStreamId, Tuple>> _pending;
-  Map<String, GlobalStreamId> _fieldLocations;
+    OutputCollector _collector;
+    Fields _idFields;
+    Fields _outFields;
+    int _numSources;
+    TimeCacheMap<List<Object>, Map<GlobalStreamId, Tuple>> _pending;
+    Map<String, GlobalStreamId> _fieldLocations;
 
-  public SingleJoinBolt(Fields outFields) {
-    _outFields = outFields;
-  }
+    public SingleJoinBolt(Fields outFields) {
+        _outFields = outFields;
+    }
 
-  @Override
-  public void prepare(Map<String, Object> conf, TopologyContext context, OutputCollector collector) {
-    _fieldLocations = new HashMap<String, GlobalStreamId>();
-    _collector = collector;
-    int timeout = ((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue();
-    _pending = new TimeCacheMap<List<Object>, Map<GlobalStreamId, Tuple>>(timeout, new ExpireCallback());
-    _numSources = context.getThisSources().size();
-    Set<String> idFields = null;
-    for (GlobalStreamId source : context.getThisSources().keySet()) {
-      Fields fields = context.getComponentOutputFields(source.get_componentId(), source.get_streamId());
-      Set<String> setFields = new HashSet<String>(fields.toList());
-      if (idFields == null)
-        idFields = setFields;
-      else
-        idFields.retainAll(setFields);
+    @Override
+    public void prepare(Map<String, Object> conf, TopologyContext context, OutputCollector collector) {
+        _fieldLocations = new HashMap<String, GlobalStreamId>();
+        _collector = collector;
+        int timeout = ((Number) conf.get(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)).intValue();
+        _pending = new TimeCacheMap<List<Object>, Map<GlobalStreamId, Tuple>>(timeout, new ExpireCallback());
+        _numSources = context.getThisSources().size();
+        Set<String> idFields = null;
+        for (GlobalStreamId source : context.getThisSources().keySet()) {
+            Fields fields = context.getComponentOutputFields(source.get_componentId(), source.get_streamId());
+            Set<String> setFields = new HashSet<String>(fields.toList());
+            if (idFields == null) {
+                idFields = setFields;
+            } else {
+                idFields.retainAll(setFields);
+            }
 
-      for (String outfield : _outFields) {
-        for (String sourcefield : fields) {
-          if (outfield.equals(sourcefield)) {
-            _fieldLocations.put(outfield, source);
-          }
+            for (String outfield : _outFields) {
+                for (String sourcefield : fields) {
+                    if (outfield.equals(sourcefield)) {
+                        _fieldLocations.put(outfield, source);
+                    }
+                }
+            }
         }
-      }
-    }
-    _idFields = new Fields(new ArrayList<String>(idFields));
+        _idFields = new Fields(new ArrayList<String>(idFields));
 
-    if (_fieldLocations.size() != _outFields.size()) {
-      throw new RuntimeException("Cannot find all outfields among sources");
+        if (_fieldLocations.size() != _outFields.size()) {
+            throw new RuntimeException("Cannot find all outfields among sources");
+        }
     }
-  }
 
-  @Override
-  public void execute(Tuple tuple) {
-    List<Object> id = tuple.select(_idFields);
-    GlobalStreamId streamId = new GlobalStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId());
-    if (!_pending.containsKey(id)) {
-      _pending.put(id, new HashMap<GlobalStreamId, Tuple>());
-    }
-    Map<GlobalStreamId, Tuple> parts = _pending.get(id);
-    if (parts.containsKey(streamId))
-      throw new RuntimeException("Received same side of single join twice");
-    parts.put(streamId, tuple);
-    if (parts.size() == _numSources) {
-      _pending.remove(id);
-      List<Object> joinResult = new ArrayList<Object>();
-      for (String outField : _outFields) {
-        GlobalStreamId loc = _fieldLocations.get(outField);
-        joinResult.add(parts.get(loc).getValueByField(outField));
-      }
-      _collector.emit(new ArrayList<Tuple>(parts.values()), joinResult);
+    @Override
+    public void execute(Tuple tuple) {
+        List<Object> id = tuple.select(_idFields);
+        GlobalStreamId streamId = new GlobalStreamId(tuple.getSourceComponent(), tuple.getSourceStreamId());
+        if (!_pending.containsKey(id)) {
+            _pending.put(id, new HashMap<GlobalStreamId, Tuple>());
+        }
+        Map<GlobalStreamId, Tuple> parts = _pending.get(id);
+        if (parts.containsKey(streamId)) {
+            throw new RuntimeException("Received same side of single join twice");
+        }
+        parts.put(streamId, tuple);
+        if (parts.size() == _numSources) {
+            _pending.remove(id);
+            List<Object> joinResult = new ArrayList<Object>();
+            for (String outField : _outFields) {
+                GlobalStreamId loc = _fieldLocations.get(outField);
+                joinResult.add(parts.get(loc).getValueByField(outField));
+            }
+            _collector.emit(new ArrayList<Tuple>(parts.values()), joinResult);
 
-      for (Tuple part : parts.values()) {
-        _collector.ack(part);
-      }
+            for (Tuple part : parts.values()) {
+                _collector.ack(part);
+            }
+        }
     }
-  }
-
-  @Override
-  public void declareOutputFields(OutputFieldsDeclarer declarer) {
-    declarer.declare(_outFields);
-  }
 
-  private class ExpireCallback implements TimeCacheMap.ExpiredCallback<List<Object>, Map<GlobalStreamId, Tuple>> {
     @Override
-    public void expire(List<Object> id, Map<GlobalStreamId, Tuple> tuples) {
-      for (Tuple tuple : tuples.values()) {
-        _collector.fail(tuple);
-      }
+    public void declareOutputFields(OutputFieldsDeclarer declarer) {
+        declarer.declare(_outFields);
+    }
+
+    private class ExpireCallback implements TimeCacheMap.ExpiredCallback<List<Object>, Map<GlobalStreamId, Tuple>> {
+        @Override
+        public void expire(List<Object> id, Map<GlobalStreamId, Tuple> tuples) {
+            for (Tuple tuple : tuples.values()) {
+                _collector.fail(tuple);
+            }
+        }
     }
-  }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SlidingWindowSumBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SlidingWindowSumBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SlidingWindowSumBolt.java
index cf9801f..7987717 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SlidingWindowSumBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/SlidingWindowSumBolt.java
@@ -1,22 +1,19 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.bolt;
 
+import java.util.List;
+import java.util.Map;
 import org.apache.storm.task.OutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.OutputFieldsDeclarer;
@@ -28,9 +25,6 @@ import org.apache.storm.windowing.TupleWindow;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.List;
-import java.util.Map;
-
 /**
  * Computes sliding window sum
  */
@@ -47,23 +41,23 @@ public class SlidingWindowSumBolt extends BaseWindowedBolt {
 
     @Override
     public void execute(TupleWindow inputWindow) {
-            /*
-             * The inputWindow gives a view of
-             * (a) all the events in the window
-             * (b) events that expired since last activation of the window
-             * (c) events that newly arrived since last activation of the window
-             */
+        /*
+         * The inputWindow gives a view of
+         * (a) all the events in the window
+         * (b) events that expired since last activation of the window
+         * (c) events that newly arrived since last activation of the window
+         */
         List<Tuple> tuplesInWindow = inputWindow.get();
         List<Tuple> newTuples = inputWindow.getNew();
         List<Tuple> expiredTuples = inputWindow.getExpired();
 
         LOG.debug("Events in current window: " + tuplesInWindow.size());
-            /*
-             * Instead of iterating over all the tuples in the window to compute
-             * the sum, the values for the new events are added and old events are
-             * subtracted. Similar optimizations might be possible in other
-             * windowing computations.
-             */
+        /*
+         * Instead of iterating over all the tuples in the window to compute
+         * the sum, the values for the new events are added and old events are
+         * subtracted. Similar optimizations might be possible in other
+         * windowing computations.
+         */
         for (Tuple tuple : newTuples) {
             sum += (int) tuple.getValue(0);
         }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/TotalRankingsBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/TotalRankingsBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/TotalRankingsBolt.java
index bfed34e..e185a9e 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/TotalRankingsBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/bolt/TotalRankingsBolt.java
@@ -1,25 +1,20 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.bolt;
 
-import org.apache.storm.tuple.Tuple;
 import org.apache.log4j.Logger;
 import org.apache.storm.starter.tools.Rankings;
+import org.apache.storm.tuple.Tuple;
 
 /**
  * This bolt merges incoming {@link Rankings}.
@@ -29,31 +24,31 @@ import org.apache.storm.starter.tools.Rankings;
  */
 public final class TotalRankingsBolt extends AbstractRankerBolt {
 
-  private static final long serialVersionUID = -8447525895532302198L;
-  private static final Logger LOG = Logger.getLogger(TotalRankingsBolt.class);
+    private static final long serialVersionUID = -8447525895532302198L;
+    private static final Logger LOG = Logger.getLogger(TotalRankingsBolt.class);
 
-  public TotalRankingsBolt() {
-    super();
-  }
+    public TotalRankingsBolt() {
+        super();
+    }
 
-  public TotalRankingsBolt(int topN) {
-    super(topN);
-  }
+    public TotalRankingsBolt(int topN) {
+        super(topN);
+    }
 
-  public TotalRankingsBolt(int topN, int emitFrequencyInSeconds) {
-    super(topN, emitFrequencyInSeconds);
-  }
+    public TotalRankingsBolt(int topN, int emitFrequencyInSeconds) {
+        super(topN, emitFrequencyInSeconds);
+    }
 
-  @Override
-  void updateRankingsWithTuple(Tuple tuple) {
-    Rankings rankingsToBeMerged = (Rankings) tuple.getValue(0);
-    super.getRankings().updateWith(rankingsToBeMerged);
-    super.getRankings().pruneZeroCounts();
-  }
+    @Override
+    void updateRankingsWithTuple(Tuple tuple) {
+        Rankings rankingsToBeMerged = (Rankings) tuple.getValue(0);
+        super.getRankings().updateWith(rankingsToBeMerged);
+        super.getRankings().pruneZeroCounts();
+    }
 
-  @Override
-  Logger getLogger() {
-    return LOG;
-  }
+    @Override
+    Logger getLogger() {
+        return LOG;
+    }
 
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomIntegerSpout.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomIntegerSpout.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomIntegerSpout.java
index 37b2ec4..e1a9ee5 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomIntegerSpout.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomIntegerSpout.java
@@ -1,22 +1,19 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.spout;
 
+import java.util.Map;
+import java.util.Random;
 import org.apache.storm.spout.SpoutOutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.OutputFieldsDeclarer;
@@ -27,9 +24,6 @@ import org.apache.storm.utils.Utils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Map;
-import java.util.Random;
-
 /**
  * Emits a random integer and a timestamp value (offset by one day),
  * every 100 ms. The ts field can be used in tuple time based windowing.

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomNumberGeneratorSpout.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomNumberGeneratorSpout.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomNumberGeneratorSpout.java
index 866cc80..e6c4804 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomNumberGeneratorSpout.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomNumberGeneratorSpout.java
@@ -1,34 +1,27 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  * <p>
  * http://www.apache.org/licenses/LICENSE-2.0
  * <p>
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions
+ * and limitations under the License.
  */
-package org.apache.storm.starter.spout;
 
-import org.apache.storm.Config;
-import org.apache.storm.task.TopologyContext;
-import org.apache.storm.trident.operation.TridentCollector;
-import org.apache.storm.trident.spout.IBatchSpout;
-import org.apache.storm.tuple.Fields;
+package org.apache.storm.starter.spout;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ThreadLocalRandom;
+import org.apache.storm.Config;
+import org.apache.storm.task.TopologyContext;
+import org.apache.storm.trident.operation.TridentCollector;
+import org.apache.storm.trident.spout.IBatchSpout;
+import org.apache.storm.tuple.Fields;
 
 /**
  * This spout generates random whole numbers with given {@code maxNumber} value as maximum with the given {@code fields}.
@@ -53,13 +46,13 @@ public class RandomNumberGeneratorSpout implements IBatchSpout {
     @Override
     public void emitBatch(long batchId, TridentCollector collector) {
         List<List<Object>> values = null;
-        if(batches.containsKey(batchId)) {
+        if (batches.containsKey(batchId)) {
             values = batches.get(batchId);
         } else {
             values = new ArrayList<>();
             for (int i = 0; i < batchSize; i++) {
                 List<Object> numbers = new ArrayList<>();
-                for (int x=0; x<fields.size(); x++) {
+                for (int x = 0; x < fields.size(); x++) {
                     numbers.add(ThreadLocalRandom.current().nextInt(0, maxNumber + 1));
                 }
                 values.add(numbers);

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomSentenceSpout.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomSentenceSpout.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomSentenceSpout.java
index 733c9d9..e3e0a68 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomSentenceSpout.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/spout/RandomSentenceSpout.java
@@ -1,22 +1,21 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.spout;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Map;
+import java.util.Random;
 import org.apache.storm.spout.SpoutOutputCollector;
 import org.apache.storm.task.TopologyContext;
 import org.apache.storm.topology.OutputFieldsDeclarer;
@@ -27,71 +26,68 @@ import org.apache.storm.utils.Utils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-import java.util.Random;
-
 public class RandomSentenceSpout extends BaseRichSpout {
-  private static final Logger LOG = LoggerFactory.getLogger(RandomSentenceSpout.class);
+    private static final Logger LOG = LoggerFactory.getLogger(RandomSentenceSpout.class);
 
-  SpoutOutputCollector _collector;
-  Random _rand;
+    SpoutOutputCollector _collector;
+    Random _rand;
 
 
-  @Override
-  public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) {
-    _collector = collector;
-    _rand = new Random();
-  }
+    @Override
+    public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) {
+        _collector = collector;
+        _rand = new Random();
+    }
 
-  @Override
-  public void nextTuple() {
-    Utils.sleep(100);
-    String[] sentences = new String[]{sentence("the cow jumped over the moon"), sentence("an apple a day keeps the doctor away"),
-            sentence("four score and seven years ago"), sentence("snow white and the seven dwarfs"), sentence("i am at two with nature")};
-    final String sentence = sentences[_rand.nextInt(sentences.length)];
+    @Override
+    public void nextTuple() {
+        Utils.sleep(100);
+        String[] sentences = new String[]{
+            sentence("the cow jumped over the moon"), sentence("an apple a day keeps the doctor away"),
+            sentence("four score and seven years ago"), sentence("snow white and the seven dwarfs"), sentence("i am at two with nature")
+        };
+        final String sentence = sentences[_rand.nextInt(sentences.length)];
 
-    LOG.debug("Emitting tuple: {}", sentence);
+        LOG.debug("Emitting tuple: {}", sentence);
 
-    _collector.emit(new Values(sentence));
-  }
+        _collector.emit(new Values(sentence));
+    }
 
-  protected String sentence(String input) {
-    return input;
-  }
+    protected String sentence(String input) {
+        return input;
+    }
 
-  @Override
-  public void ack(Object id) {
-  }
+    @Override
+    public void ack(Object id) {
+    }
 
-  @Override
-  public void fail(Object id) {
-  }
+    @Override
+    public void fail(Object id) {
+    }
 
-  @Override
-  public void declareOutputFields(OutputFieldsDeclarer declarer) {
-    declarer.declare(new Fields("word"));
-  }
+    @Override
+    public void declareOutputFields(OutputFieldsDeclarer declarer) {
+        declarer.declare(new Fields("word"));
+    }
 
-  // Add unique identifier to each tuple, which is helpful for debugging
-  public static class TimeStamped extends RandomSentenceSpout {
-    private final String prefix;
+    // Add unique identifier to each tuple, which is helpful for debugging
+    public static class TimeStamped extends RandomSentenceSpout {
+        private final String prefix;
 
-    public TimeStamped() {
-      this("");
-    }
+        public TimeStamped() {
+            this("");
+        }
 
-    public TimeStamped(String prefix) {
-      this.prefix = prefix;
-    }
+        public TimeStamped(String prefix) {
+            this.prefix = prefix;
+        }
 
-    protected String sentence(String input) {
-      return prefix + currentDate() + " " + input;
-    }
+        protected String sentence(String input) {
+            return prefix + currentDate() + " " + input;
+        }
 
-    private String currentDate() {
-      return new SimpleDateFormat("yyyy.MM.dd_HH:mm:ss.SSSSSSSSS").format(new Date());
+        private String currentDate() {
+            return new SimpleDateFormat("yyyy.MM.dd_HH:mm:ss.SSSSSSSSS").format(new Date());
+        }
     }
-  }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/AggregateExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/AggregateExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/AggregateExample.java
index dae774b..feaff4f 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/AggregateExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/AggregateExample.java
@@ -1,20 +1,15 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import org.apache.storm.Config;
@@ -40,10 +35,10 @@ public class AggregateExample {
          * results are merged and the final result is emitted.
          */
         builder.newStream(new RandomIntegerSpout(), new ValueMapper<Integer>(0), 2)
-                .window(TumblingWindows.of(BaseWindowedBolt.Duration.seconds(5)))
-                .filter(x -> x > 0 && x < 500)
-                .aggregate(new Avg())
-                .print();
+               .window(TumblingWindows.of(BaseWindowedBolt.Duration.seconds(5)))
+               .filter(x -> x > 0 && x < 500)
+               .aggregate(new Avg())
+               .print();
 
         Config config = new Config();
         String topoName = "AGG_EXAMPLE";
@@ -69,14 +64,14 @@ public class AggregateExample {
         public Pair<Integer, Integer> merge(Pair<Integer, Integer> sumAndCount1, Pair<Integer, Integer> sumAndCount2) {
             System.out.println("Merge " + sumAndCount1 + " and " + sumAndCount2);
             return Pair.of(
-                    sumAndCount1._1 + sumAndCount2._1,
-                    sumAndCount1._2 + sumAndCount2._2
+                sumAndCount1._1 + sumAndCount2._1,
+                sumAndCount1._2 + sumAndCount2._2
             );
         }
 
         @Override
         public Double result(Pair<Integer, Integer> sumAndCount) {
-            return (double) sumAndCount._1/sumAndCount._2;
+            return (double) sumAndCount._1 / sumAndCount._2;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/BranchExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/BranchExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/BranchExample.java
index f8d865f..d20f071 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/BranchExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/BranchExample.java
@@ -1,20 +1,15 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import org.apache.storm.Config;
@@ -38,18 +33,18 @@ public class BranchExample {
     public static void main(String[] args) throws Exception {
         StreamBuilder builder = new StreamBuilder();
         Stream<Integer>[] evenAndOdd = builder
-                /*
-                 * Create a stream of random numbers from a spout that
-                 * emits random integers by extracting the tuple value at index 0.
-                 */
-                .newStream(new RandomIntegerSpout(), new ValueMapper<Integer>(0))
-                /*
-                 * Split the stream of numbers into streams of
-                 * even and odd numbers. The first stream contains even
-                 * and the second contains odd numbers.
-                 */
-                .branch(x -> (x % 2) == 0,
-                        x -> (x % 2) == 1);
+            /*
+             * Create a stream of random numbers from a spout that
+             * emits random integers by extracting the tuple value at index 0.
+             */
+            .newStream(new RandomIntegerSpout(), new ValueMapper<Integer>(0))
+            /*
+             * Split the stream of numbers into streams of
+             * even and odd numbers. The first stream contains even
+             * and the second contains odd numbers.
+             */
+            .branch(x -> (x % 2) == 0,
+                    x -> (x % 2) == 1);
 
         evenAndOdd[0].forEach(x -> LOG.info("EVEN> " + x));
         evenAndOdd[1].forEach(x -> LOG.info("ODD > " + x));
@@ -59,7 +54,7 @@ public class BranchExample {
         if (args.length > 0) {
             topoName = args[0];
         }
-         
+
         config.setNumWorkers(1);
         StormSubmitter.submitTopologyWithProgressBar(topoName, config, builder.build());
     }

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/GroupByKeyAndWindowExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/GroupByKeyAndWindowExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/GroupByKeyAndWindowExample.java
index 1e154b7..6bcf194 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/GroupByKeyAndWindowExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/GroupByKeyAndWindowExample.java
@@ -1,26 +1,20 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
-
 import org.apache.storm.Config;
 import org.apache.storm.StormSubmitter;
 import org.apache.storm.spout.SpoutOutputCollector;
@@ -48,27 +42,27 @@ public class GroupByKeyAndWindowExample {
 
         // a stream of stock quotes
         builder.newStream(new StockQuotes(), new PairValueMapper<String, Double>(0, 1))
-                /*
-                 * The elements having the same key within the window will be grouped
-                 * together and the corresponding values will be merged.
-                 *
-                 * The result is a PairStream<String, Iterable<Double>> with
-                 * 'stock symbol' as the key and 'stock prices' for that symbol within the window as the value.
-                 */
-                .groupByKeyAndWindow(SlidingWindows.of(Count.of(6), Count.of(3)))
-                .print();
+               /*
+                * The elements having the same key within the window will be grouped
+                * together and the corresponding values will be merged.
+                *
+                * The result is a PairStream<String, Iterable<Double>> with
+                * 'stock symbol' as the key and 'stock prices' for that symbol within the window as the value.
+                */
+               .groupByKeyAndWindow(SlidingWindows.of(Count.of(6), Count.of(3)))
+               .print();
 
         // a stream of stock quotes
         builder.newStream(new StockQuotes(), new PairValueMapper<String, Double>(0, 1))
-                /*
-                 * The elements having the same key within the window will be grouped
-                 * together and their values will be reduced using the given reduce function.
-                 *
-                 * Here the result is a PairStream<String, Double> with
-                 * 'stock symbol' as the key and the maximum price for that symbol within the window as the value.
-                 */
-                .reduceByKeyAndWindow((x, y) -> x > y ? x : y, SlidingWindows.of(Count.of(6), Count.of(3)))
-                .print();
+               /*
+                * The elements having the same key within the window will be grouped
+                * together and their values will be reduced using the given reduce function.
+                *
+                * Here the result is a PairStream<String, Double> with
+                * 'stock symbol' as the key and the maximum price for that symbol within the window as the value.
+                */
+               .reduceByKeyAndWindow((x, y) -> x > y ? x : y, SlidingWindows.of(Count.of(6), Count.of(3)))
+               .print();
 
         Config config = new Config();
         String topoName = GroupByKeyAndWindowExample.class.getName();
@@ -81,9 +75,9 @@ public class GroupByKeyAndWindowExample {
 
     private static class StockQuotes extends BaseRichSpout {
         private final List<List<Values>> values = Arrays.asList(
-                Arrays.asList(new Values("AAPL", 100.0), new Values("GOOG", 780.0), new Values("FB", 125.0)),
-                Arrays.asList(new Values("AAPL", 105.0), new Values("GOOG", 790.0), new Values("FB", 130.0)),
-                Arrays.asList(new Values("AAPL", 102.0), new Values("GOOG", 788.0), new Values("FB", 128.0))
+            Arrays.asList(new Values("AAPL", 100.0), new Values("GOOG", 780.0), new Values("FB", 125.0)),
+            Arrays.asList(new Values("AAPL", 105.0), new Values("GOOG", 790.0), new Values("FB", 130.0)),
+            Arrays.asList(new Values("AAPL", 102.0), new Values("GOOG", 788.0), new Values("FB", 128.0))
         );
         private SpoutOutputCollector collector;
         private int index = 0;

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/JoinExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/JoinExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/JoinExample.java
index 020239d..52bbf28 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/JoinExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/JoinExample.java
@@ -1,24 +1,18 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import java.util.Map;
-
 import org.apache.storm.Config;
 import org.apache.storm.StormSubmitter;
 import org.apache.storm.spout.SpoutOutputCollector;
@@ -44,25 +38,25 @@ public class JoinExample {
         StreamBuilder builder = new StreamBuilder();
         // a stream of (number, square) pairs
         PairStream<Integer, Integer> squares = builder
-                .newStream(new NumberSpout(x -> x * x),
-                        new PairValueMapper<>(0, 1));
+            .newStream(new NumberSpout(x -> x * x),
+                       new PairValueMapper<>(0, 1));
         // a stream of (number, cube) pairs
         PairStream<Integer, Integer> cubes = builder
-                .newStream(new NumberSpout(x -> x * x * x),
-                        new PairValueMapper<>(0, 1));
+            .newStream(new NumberSpout(x -> x * x * x),
+                       new PairValueMapper<>(0, 1));
 
         // create a windowed stream of five seconds duration
         squares.window(TumblingWindows.of(Duration.seconds(5)))
-                /*
-                 * Join the squares and the cubes stream within the window.
-                 * The values in the squares stream having the same key as that
-                 * of the cubes stream within the window will be joined together.
-                 */
-                .join(cubes)
-                /**
-                 * The results should be of the form (number, (square, cube))
-                 */
-                .print();
+               /*
+                * Join the squares and the cubes stream within the window.
+                * The values in the squares stream having the same key as that
+                * of the cubes stream within the window will be joined together.
+                */
+               .join(cubes)
+               /**
+                * The results should be of the form (number, (square, cube))
+                */
+               .print();
 
         Config config = new Config();
         String topoName = JoinExample.class.getName();

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StateQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StateQueryExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StateQueryExample.java
index 3cd1199..4e5b1ef 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StateQueryExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StateQueryExample.java
@@ -1,24 +1,18 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import java.util.Map;
-
 import org.apache.storm.Config;
 import org.apache.storm.StormSubmitter;
 import org.apache.storm.spout.SpoutOutputCollector;
@@ -53,27 +47,28 @@ public class StateQueryExample {
     public static void main(String[] args) throws Exception {
         StreamBuilder builder = new StreamBuilder();
         StreamState<String, Long> ss = builder.newStream(new TestWordSpout(), new ValueMapper<String>(0), 2)
-                /*
-                 * Transform the stream of words to a stream of (word, 1) pairs
-                 */
-                .mapToPair(w -> Pair.of(w, 1))
-                /*
-                 *  Update the count in the state. Here the first argument 0L is the initial value for the count and
-                 *  the second argument is a function that increments the count for each value received.
-                 */
-                .updateStateByKey(0L, (count, val) -> count + 1);
+                                              /*
+                                               * Transform the stream of words to a stream of (word, 1) pairs
+                                               */
+                                              .mapToPair(w -> Pair.of(w, 1))
+                                              /*
+                                               *  Update the count in the state. Here the first argument 0L is the initial value for the
+                                               *  count and
+                                               *  the second argument is a function that increments the count for each value received.
+                                               */
+                                              .updateStateByKey(0L, (count, val) -> count + 1);
 
         /*
          * A stream of words emitted by the QuerySpout is used as
          * the keys to query the state.
          */
         builder.newStream(new QuerySpout(), new ValueMapper<String>(0))
-                /*
-                 * Queries the state and emits the
-                 * matching (key, value) as results. The stream state returned
-                 * by the updateStateByKey is passed as the argument to stateQuery.
-                 */
-                .stateQuery(ss).print();
+               /*
+                * Queries the state and emits the
+                * matching (key, value) as results. The stream state returned
+                * by the updateStateByKey is passed as the argument to stateQuery.
+                */
+               .stateQuery(ss).print();
 
         Config config = new Config();
         // use redis based state store for persistence
@@ -87,8 +82,8 @@ public class StateQueryExample {
     }
 
     private static class QuerySpout extends BaseRichSpout {
+        private final String[] words = { "nathan", "mike" };
         private SpoutOutputCollector collector;
-        private final String[] words = {"nathan", "mike"};
 
         @Override
         public void open(Map<String, Object> conf, TopologyContext context, SpoutOutputCollector collector) {

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StatefulWordCount.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StatefulWordCount.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StatefulWordCount.java
index aba19f3..afc345d 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StatefulWordCount.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/StatefulWordCount.java
@@ -1,20 +1,15 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import org.apache.storm.Config;
@@ -48,26 +43,26 @@ public class StatefulWordCount {
         StreamBuilder builder = new StreamBuilder();
         // a stream of words
         builder.newStream(new TestWordSpout(), new ValueMapper<String>(0), 2)
-                .window(TumblingWindows.of(BaseWindowedBolt.Duration.seconds(2)))
-                /*
-                 * create a stream of (word, 1) pairs
-                 */
-                .mapToPair(w -> Pair.of(w, 1))
-                /*
-                 * compute the word counts in the last two second window
-                 */
-                .countByKey()
-                /*
-                 * update the word counts in the state.
-                 * Here the first argument 0L is the initial value for the state
-                 * and the second argument is a function that adds the count to the current value in the state.
-                 */
-                .updateStateByKey(0L, (state, count) -> state + count)
-                 /*
-                  * convert the state back to a stream and print the results
-                  */
-                .toPairStream()
-                .print();
+               .window(TumblingWindows.of(BaseWindowedBolt.Duration.seconds(2)))
+               /*
+                * create a stream of (word, 1) pairs
+                */
+               .mapToPair(w -> Pair.of(w, 1))
+               /*
+                * compute the word counts in the last two second window
+                */
+               .countByKey()
+               /*
+                * update the word counts in the state.
+                * Here the first argument 0L is the initial value for the state
+                * and the second argument is a function that adds the count to the current value in the state.
+                */
+               .updateStateByKey(0L, (state, count) -> state + count)
+               /*
+                * convert the state back to a stream and print the results
+                */
+               .toPairStream()
+               .print();
 
         Config config = new Config();
         // use redis based state store for persistence

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/TypedTupleExample.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/TypedTupleExample.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/TypedTupleExample.java
index a74151b..e859ca1 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/TypedTupleExample.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/TypedTupleExample.java
@@ -1,20 +1,15 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import org.apache.storm.Config;

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WindowedWordCount.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WindowedWordCount.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WindowedWordCount.java
index 50c8aad..2c06674 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WindowedWordCount.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WindowedWordCount.java
@@ -1,24 +1,18 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import java.util.Arrays;
-
 import org.apache.storm.Config;
 import org.apache.storm.StormSubmitter;
 import org.apache.storm.starter.spout.RandomSentenceSpout;
@@ -36,31 +30,31 @@ public class WindowedWordCount {
         StreamBuilder builder = new StreamBuilder();
         // A stream of random sentences
         builder.newStream(new RandomSentenceSpout(), new ValueMapper<String>(0), 2)
-                /*
-                 * a two seconds tumbling window
-                 */
-                .window(TumblingWindows.of(Duration.seconds(2)))
-                /*
-                 * split the sentences to words
-                 */
-                .flatMap(s -> Arrays.asList(s.split(" ")))
-                /*
-                 * create a stream of (word, 1) pairs
-                 */
-                .mapToPair(w -> Pair.of(w, 1))
-                /*
-                 * compute the word counts in the last two second window
-                 */
-                .countByKey()
-                /*
-                 * emit the count for the words that occurred
-                 * at-least five times in the last two seconds
-                 */
-                .filter(x -> x.getSecond() >= 5)
-                /*
-                 * print the results to stdout
-                 */
-                .print();
+               /*
+                * a two seconds tumbling window
+                */
+               .window(TumblingWindows.of(Duration.seconds(2)))
+               /*
+                * split the sentences to words
+                */
+               .flatMap(s -> Arrays.asList(s.split(" ")))
+               /*
+                * create a stream of (word, 1) pairs
+                */
+               .mapToPair(w -> Pair.of(w, 1))
+               /*
+                * compute the word counts in the last two second window
+                */
+               .countByKey()
+               /*
+                * emit the count for the words that occurred
+                * at-least five times in the last two seconds
+                */
+               .filter(x -> x.getSecond() >= 5)
+               /*
+                * print the results to stdout
+                */
+               .print();
 
         Config config = new Config();
         String topoName = "test";

http://git-wip-us.apache.org/repos/asf/storm/blob/81ec15d1/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WordCountToBolt.java
----------------------------------------------------------------------
diff --git a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WordCountToBolt.java b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WordCountToBolt.java
index 360f0ad..082b96a 100644
--- a/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WordCountToBolt.java
+++ b/examples/storm-starter/src/jvm/org/apache/storm/starter/streams/WordCountToBolt.java
@@ -1,20 +1,15 @@
 /**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version
+ * 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
+ * and limitations under the License.
  */
+
 package org.apache.storm.starter.streams;
 
 import org.apache.storm.Config;
@@ -40,7 +35,7 @@ public class WordCountToBolt {
 
         // Redis config parameters for the RedisStoreBolt
         JedisPoolConfig poolConfig = new JedisPoolConfig.Builder()
-                .setHost("127.0.0.1").setPort(6379).build();
+            .setHost("127.0.0.1").setPort(6379).build();
         // Storm tuple to redis key-value mapper
         RedisStoreMapper storeMapper = new WordCountStoreMapper();
         // The redis bolt (sink)
@@ -48,21 +43,21 @@ public class WordCountToBolt {
 
         // A stream of words
         builder.newStream(new TestWordSpout(), new ValueMapper<String>(0))
-                /*
-                 * create a stream of (word, 1) pairs
-                 */
-                .mapToPair(w -> Pair.of(w, 1))
-                /*
-                 * aggregate the count
-                 */
-                .countByKey()
-                /*
-                 * The result of aggregation is forwarded to
-                 * the RedisStoreBolt. The forwarded tuple is a
-                 * key-value pair of (word, count) with ("key", "value")
-                 * being the field names.
-                 */
-                .to(redisStoreBolt);
+               /*
+                * create a stream of (word, 1) pairs
+                */
+               .mapToPair(w -> Pair.of(w, 1))
+               /*
+                * aggregate the count
+                */
+               .countByKey()
+               /*
+                * The result of aggregation is forwarded to
+                * the RedisStoreBolt. The forwarded tuple is a
+                * key-value pair of (word, count) with ("key", "value")
+                * being the field names.
+                */
+               .to(redisStoreBolt);
 
         Config config = new Config();
         String topoName = "test";