Fix checkstyle whitespace issues - WHITESPACE ONLY

Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightContext.java b/src/main/java/net/floodlightcontroller/core/FloodlightContext.java
index aa4fe6b..2b915f0 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightContext.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightContext.java
@@ -1,28 +1,29 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- * This is a context object where floodlight listeners can register 
+ * This is a context object where floodlight listeners can register
  * and later retrieve context information associated with an
  * event
+ *
  * @author readams
  */
 public class FloodlightContext {
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightContextStore.java b/src/main/java/net/floodlightcontroller/core/FloodlightContextStore.java
index 5455284..684cdd7 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightContextStore.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightContextStore.java
@@ -1,33 +1,33 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
 public class FloodlightContextStore<V> {
-    
+
     @SuppressWarnings("unchecked")
     public V get(FloodlightContext bc, String key) {
-        return (V)bc.storage.get(key);
+        return (V) bc.storage.get(key);
     }
-    
+
     public void put(FloodlightContext bc, String key, V value) {
         bc.storage.put(key, value);
     }
-    
+
     public void remove(FloodlightContext bc, String key) {
         bc.storage.remove(key);
     }
diff --git a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
index 0790c17..4183877 100644
--- a/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
+++ b/src/main/java/net/floodlightcontroller/core/FloodlightProvider.java
@@ -17,7 +17,7 @@
 
 public class FloodlightProvider implements IFloodlightModule {
     Controller controller;
-    
+
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
         Collection<Class<? extends IFloodlightService>> services =
@@ -28,13 +28,13 @@
 
     @Override
     public Map<Class<? extends IFloodlightService>,
-               IFloodlightService> getServiceImpls() {
+            IFloodlightService> getServiceImpls() {
         controller = new Controller();
-        
+
         Map<Class<? extends IFloodlightService>,
-            IFloodlightService> m = 
+                IFloodlightService> m =
                 new HashMap<Class<? extends IFloodlightService>,
-                            IFloodlightService>();
+                        IFloodlightService>();
         m.put(IFloodlightProviderService.class, controller);
         return m;
     }
@@ -42,7 +42,7 @@
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleDependencies() {
         Collection<Class<? extends IFloodlightService>> dependencies =
-            new ArrayList<Class<? extends IFloodlightService>>(4);
+                new ArrayList<Class<? extends IFloodlightService>>(4);
         dependencies.add(IRestApiService.class);
         dependencies.add(IThreadPoolService.class);
         // Following added by ONOS
@@ -54,17 +54,17 @@
 
     @Override
     public void init(FloodlightModuleContext context) throws FloodlightModuleException {
-       controller.setRestApiService(
-           context.getServiceImpl(IRestApiService.class));
-       controller.setThreadPoolService(
-           context.getServiceImpl(IThreadPoolService.class));
-       // Following added by ONOS
-       controller.setMastershipService(
-    		   context.getServiceImpl(IControllerRegistryService.class));
-       controller.setLinkDiscoveryService(
-    		   context.getServiceImpl(ILinkDiscoveryService.class));
+        controller.setRestApiService(
+                context.getServiceImpl(IRestApiService.class));
+        controller.setThreadPoolService(
+                context.getServiceImpl(IThreadPoolService.class));
+        // Following added by ONOS
+        controller.setMastershipService(
+                context.getServiceImpl(IControllerRegistryService.class));
+        controller.setLinkDiscoveryService(
+                context.getServiceImpl(ILinkDiscoveryService.class));
 
-       controller.init(context.getConfigParams(this));
+        controller.init(context.getConfigParams(this));
     }
 
     @Override
diff --git a/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java b/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
index 08e06d9..1066c8b 100644
--- a/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
+++ b/src/main/java/net/floodlightcontroller/core/IFloodlightProviderService.java
@@ -1,7 +1,7 @@
 /**
  *    Copyright 2011, Big Switch Networks, Inc. 
  *    Originally created by David Erickson, Stanford University
- * 
+ *
  *    Licensed 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
@@ -37,40 +37,45 @@
 
     /**
      * A value stored in the floodlight context containing a parsed packet
-     * representation of the payload of a packet-in message. 
+     * representation of the payload of a packet-in message.
      */
-    public static final String CONTEXT_PI_PAYLOAD = 
+    public static final String CONTEXT_PI_PAYLOAD =
             "net.floodlightcontroller.core.IFloodlightProvider.piPayload";
 
     /**
      * The role of the controller as used by the OF 1.2 and OVS failover and
      * load-balancing mechanism.
      */
-    public static enum Role { EQUAL, MASTER, SLAVE };
-    
+    public static enum Role {
+        EQUAL, MASTER, SLAVE
+    }
+
     /**
-     * A FloodlightContextStore object that can be used to retrieve the 
+     * A FloodlightContextStore object that can be used to retrieve the
      * packet-in payload
      */
-    public static final FloodlightContextStore<Ethernet> bcStore = 
+    public static final FloodlightContextStore<Ethernet> bcStore =
             new FloodlightContextStore<Ethernet>();
 
     /**
      * Adds an OpenFlow message listener
-     * @param type The OFType the component wants to listen for
+     *
+     * @param type     The OFType the component wants to listen for
      * @param listener The component that wants to listen for the message
      */
     public void addOFMessageListener(OFType type, IOFMessageListener listener);
 
     /**
      * Removes an OpenFlow message listener
-     * @param type The OFType the component no long wants to listen for
+     *
+     * @param type     The OFType the component no long wants to listen for
      * @param listener The component that no longer wants to receive the message
      */
     public void removeOFMessageListener(OFType type, IOFMessageListener listener);
-    
+
     /**
      * Return a non-modifiable list of all current listeners
+     *
      * @return listeners
      */
     public Map<OFType, List<IOFMessageListener>> getListeners();
@@ -78,34 +83,38 @@
     /**
      * Returns an unmodifiable map of all actively connected OpenFlow switches. This doesn't
      * contain switches that are connected but the controller's in the slave role.
+     *
      * @return the set of actively connected switches
      */
     public Map<Long, IOFSwitch> getSwitches();
-    
+
     /**
      * Get the current mapping of controller IDs to their IP addresses
-     * Returns a copy of the current mapping. 
+     * Returns a copy of the current mapping.
+     *
      * @see IHAListener
      */
-    public Map<String,String> getControllerNodeIPs();
-    
+    public Map<String, String> getControllerNodeIPs();
+
     /**
      * Gets the ID of the controller
      */
     public String getControllerId();
-    
+
     /**
      * Add a switch listener
+     *
      * @param listener The module that wants to listen for events
      */
     public void addOFSwitchListener(IOFSwitchListener listener);
 
     /**
      * Remove a switch listener
+     *
      * @param listener The The module that no longer wants to listen for events
      */
     public void removeOFSwitchListener(IOFSwitchListener listener);
-    
+
     /**
      * Terminate the process
      */
@@ -113,7 +122,8 @@
 
     /**
      * Re-injects an OFMessage back into the packet processing chain
-     * @param sw The switch to use for the message
+     *
+     * @param sw  The switch to use for the message
      * @param msg the message to inject
      * @return True if successfully re-injected, false otherwise
      */
@@ -121,25 +131,28 @@
 
     /**
      * Re-injects an OFMessage back into the packet processing chain
-     * @param sw The switch to use for the message
-     * @param msg the message to inject
+     *
+     * @param sw       The switch to use for the message
+     * @param msg      the message to inject
      * @param bContext a floodlight context to use if required
      * @return True if successfully re-injected, false otherwise
      */
-    public boolean injectOfMessage(IOFSwitch sw, OFMessage msg, 
-            FloodlightContext bContext);
+    public boolean injectOfMessage(IOFSwitch sw, OFMessage msg,
+                                   FloodlightContext bContext);
 
     /**
      * Process written messages through the message listeners for the controller
+     *
      * @param sw The switch being written to
-     * @param m the message 
+     * @param m  the message
      * @param bc any accompanying context object
      */
-    public void handleOutgoingMessage(IOFSwitch sw, OFMessage m, 
-            FloodlightContext bc);
+    public void handleOutgoingMessage(IOFSwitch sw, OFMessage m,
+                                      FloodlightContext bc);
 
     /**
      * Gets the BasicFactory
+     *
      * @return an OpenFlow message factory
      */
     public BasicFactory getOFMessageFactory();
@@ -148,25 +161,27 @@
      * Run the main I/O loop of the Controller.
      */
     public void run();
-   
-   /**
-    * Return the controller start time in  milliseconds
-    * @return
-    */
-   public long getSystemStartTime();
-   
-   /**
-    * Configure controller to always clear the flow table on the switch,
-    * when it connects to controller. This will be true for first time switch
-    * reconnect, as well as a switch re-attaching to Controller after HA
-    * switch over to ACTIVE role
-    */
-   public void setAlwaysClearFlowsOnSwAdd(boolean value);
-   
-   /**
-    * Publish updates to Controller updates queue
-    * @param IUpdate
-    */
-   public void publishUpdate(IUpdate update);
+
+    /**
+     * Return the controller start time in  milliseconds
+     *
+     * @return
+     */
+    public long getSystemStartTime();
+
+    /**
+     * Configure controller to always clear the flow table on the switch,
+     * when it connects to controller. This will be true for first time switch
+     * reconnect, as well as a switch re-attaching to Controller after HA
+     * switch over to ACTIVE role
+     */
+    public void setAlwaysClearFlowsOnSwAdd(boolean value);
+
+    /**
+     * Publish updates to Controller updates queue
+     *
+     * @param IUpdate
+     */
+    public void publishUpdate(IUpdate update);
 
 }
diff --git a/src/main/java/net/floodlightcontroller/core/IListener.java b/src/main/java/net/floodlightcontroller/core/IListener.java
index 1bd6560..74ff1f3 100644
--- a/src/main/java/net/floodlightcontroller/core/IListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IListener.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
@@ -21,18 +21,20 @@
     public enum Command {
         CONTINUE, STOP
     }
-    
+
     /**
      * The name assigned to this listener
+     *
      * @return
      */
     public String getName();
 
     /**
      * Check if the module called name is a callback ordering prerequisite
-     * for this module.  In other words, if this function returns true for 
+     * for this module.  In other words, if this function returns true for
      * the given name, then this message listener will be called after that
      * message listener.
+     *
      * @param type the message type to which this applies
      * @param name the name of the module
      * @return whether name is a prerequisite.
@@ -41,9 +43,10 @@
 
     /**
      * Check if the module called name is a callback ordering post-requisite
-     * for this module.  In other words, if this function returns true for 
+     * for this module.  In other words, if this function returns true for
      * the given name, then this message listener will be called before that
      * message listener.
+     *
      * @param type the message type to which this applies
      * @param name the name of the module
      * @return whether name is a post-requisite.
diff --git a/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java b/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
index 00fdac1..b14af57 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFMessageListener.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
@@ -21,18 +21,17 @@
 import org.openflow.protocol.OFType;
 
 /**
- *
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public interface IOFMessageListener extends IListener<OFType> {
-  /**
-   * This is the method Floodlight uses to call listeners with OpenFlow messages
-   * @param sw the OpenFlow switch that sent this message
-   * @param msg the message
-   * @param cntx a Floodlight message context object you can use to pass 
-   * information between listeners
-   * @return the command to continue or stop the execution
-   */
-  public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx);
+    /**
+     * This is the method Floodlight uses to call listeners with OpenFlow messages
+     *
+     * @param sw   the OpenFlow switch that sent this message
+     * @param msg  the message
+     * @param cntx a Floodlight message context object you can use to pass
+     *             information between listeners
+     * @return the command to continue or stop the execution
+     */
+    public Command receive(IOFSwitch sw, OFMessage msg, FloodlightContext cntx);
 }
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
index 5359812..90a7e12 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitch.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
@@ -35,8 +35,6 @@
 import org.openflow.protocol.statistics.OFStatistics;
 
 /**
- *
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public interface IOFSwitch {
@@ -50,64 +48,69 @@
     public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable";
     public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood";
     public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl";
-    
+
     /**
      * Writes to the OFMessage to the output stream.
      * The message will be handed to the floodlightProvider for possible filtering
      * and processing by message listeners
-     * @param m   
-     * @param bc  
-     * @throws IOException  
+     *
+     * @param m
+     * @param bc
+     * @throws IOException
      */
-    public void write(OFMessage m, FloodlightContext bc) throws IOException; 
-    
+    public void write(OFMessage m, FloodlightContext bc) throws IOException;
+
     /**
      * Writes the list of messages to the output stream
      * The message will be handed to the floodlightProvider for possible filtering
      * and processing by message listeners.
+     *
      * @param msglist
      * @param bc
      * @throws IOException
      */
     public void write(List<OFMessage> msglist, FloodlightContext bc) throws IOException;
-    
+
     /**
-     * 
      * @throws IOException
      */
     public void disconnectOutputStream();
 
     /**
      * FIXME: remove getChannel(). All access to the channel should be through
-     *        wrapper functions in IOFSwitch
+     * wrapper functions in IOFSwitch
+     *
      * @return
      */
     public Channel getChannel();
 
     /**
      * Returns switch features from features Reply
+     *
      * @return
      */
     public int getBuffers();
-    
+
     public int getActions();
-    
+
     public int getCapabilities();
-    
+
     public byte getTables();
 
     /**
      * Set the OFFeaturesReply message returned by the switch during initial
      * handshake.
+     *
      * @param featuresReply
      */
     public void setFeaturesReply(OFFeaturesReply featuresReply);
-    
+
     /**
      * Set the SwitchProperties based on it's description
+     *
      * @param description
      */
-    public void setSwitchProperties(OFDescriptionStatistics description);    
+    public void setSwitchProperties(OFDescriptionStatistics description);
 
     /**
      * Get list of all enabled ports. This will typically be different from
@@ -115,16 +118,18 @@
      * snapshot of the ports at the time the switch connected to the controller
      * whereas this port list also reflects the port status messages that have
      * been received.
+     *
      * @return Unmodifiable list of ports not backed by the underlying collection
      */
     public Collection<OFPhysicalPort> getEnabledPorts();
-    
+
     /**
      * Get list of the port numbers of all enabled ports. This will typically
      * be different from the list of ports in the OFFeaturesReply, since that
-     * one is a static snapshot of the ports at the time the switch connected 
+     * one is a static snapshot of the ports at the time the switch connected
      * to the controller whereas this port list also reflects the port status
      * messages that have been received.
+     *
      * @return Unmodifiable list of ports not backed by the underlying collection
      */
     public Collection<Short> getEnabledPortNumbers();
@@ -133,24 +138,27 @@
      * Retrieve the port object by the port number. The port object
      * is the one that reflects the port status updates that have been
      * received, not the one from the features reply.
+     *
      * @param portNumber
      * @return port object
      */
     public OFPhysicalPort getPort(short portNumber);
-    
+
     /**
      * Retrieve the port object by the port name. The port object
      * is the one that reflects the port status updates that have been
      * received, not the one from the features reply.
+     *
      * @param portName
      * @return port object
      */
     public OFPhysicalPort getPort(String portName);
-    
+
     /**
      * Add or modify a switch port. This is called by the core controller
      * code in response to a OFPortStatus message. It should not typically be
      * called by other floodlight applications.
+     *
      * @param port
      */
     public void setPort(OFPhysicalPort port);
@@ -159,25 +167,28 @@
      * Delete a port for the switch. This is called by the core controller
      * code in response to a OFPortStatus message. It should not typically be
      * called by other floodlight applications.
+     *
      * @param portNumber
      */
     public void deletePort(short portNumber);
-    
+
     /**
      * Delete a port for the switch. This is called by the core controller
      * code in response to a OFPortStatus message. It should not typically be
      * called by other floodlight applications.
+     *
      * @param portName
      */
     public void deletePort(String portName);
-    
+
     /**
      * Get list of all ports. This will typically be different from
      * the list of ports in the OFFeaturesReply, since that one is a static
      * snapshot of the ports at the time the switch connected to the controller
      * whereas this port list also reflects the port status messages that have
      * been received.
-     * @return Unmodifiable list of ports 
+     *
+     * @return Unmodifiable list of ports
      */
     public Collection<OFPhysicalPort> getPorts();
 
@@ -187,7 +198,7 @@
      * (not configured down nor link down nor in spanning tree blocking state)
      */
     public boolean portEnabled(short portName);
-    
+
     /**
      * @param portNumber
      * @return Whether a port is enabled per latest port status message
@@ -204,30 +215,35 @@
 
     /**
      * Get the datapathId of the switch
+     *
      * @return
      */
     public long getId();
 
     /**
      * Get a string version of the ID for this switch
+     *
      * @return
      */
     public String getStringId();
-    
+
     /**
      * Retrieves attributes of this switch
+     *
      * @return
      */
     public Map<Object, Object> getAttributes();
 
     /**
      * Retrieves the date the switch connected to this controller
+     *
      * @return the date
      */
     public Date getConnectedSince();
 
     /**
      * Returns the next available transaction id
+     *
      * @return
      */
     public int getNextTransactionId();
@@ -238,24 +254,25 @@
      *
      * @param request statistics request
      * @return Future object wrapping OFStatisticsReply
-     * @throws IOException 
+     * @throws IOException
      */
     public Future<List<OFStatistics>> getStatistics(OFStatisticsRequest request)
             throws IOException;
-    
+
     /**
      * Returns a Future object that can be used to retrieve the asynchronous
      * OFStatisticsReply when it is available.
      *
      * @param request statistics request
      * @return Future object wrapping OFStatisticsReply
-     * @throws IOException 
+     * @throws IOException
      */
     public Future<OFFeaturesReply> getFeaturesReplyFromSwitch()
             throws IOException;
 
     /**
      * Deliver the featuresReply future reply
+     *
      * @param reply the reply to deliver
      */
     void deliverOFFeaturesReply(OFMessage reply);
@@ -269,42 +286,48 @@
     /**
      * Check if the switch is still connected;
      * Only call while holding processMessageLock
+     *
      * @return whether the switch is still disconnected
      */
     public boolean isConnected();
-    
+
     /**
      * Set whether the switch is connected
      * Only call while holding modifySwitchLock
+     *
      * @param connected whether the switch is connected
      */
     public void setConnected(boolean connected);
-    
+
     /**
      * Get the current role of the controller for the switch
+     *
      * @return the role of the controller
      */
     public Role getRole();
-    
+
     /**
      * Check if the controller is an active controller for the switch.
      * The controller is active if its role is MASTER or EQUAL.
+     *
      * @return whether the controller is active
      */
     public boolean isActive();
-    
+
     /**
      * Deliver the statistics future reply
+     *
      * @param reply the reply to deliver
      */
     public void deliverStatisticsReply(OFMessage reply);
-    
+
     /**
      * Cancel the statistics reply with the given transaction ID
+     *
      * @param transactionId the transaction ID
      */
     public void cancelStatisticsReply(int transactionId);
-    
+
     /**
      * Cancel all statistics replies
      */
@@ -312,6 +335,7 @@
 
     /**
      * Checks if a specific switch property exists for this switch
+     *
      * @param name name of property
      * @return value for name
      */
@@ -319,6 +343,7 @@
 
     /**
      * Set properties for switch specific behavior
+     *
      * @param name name of property
      * @return value for name
      */
@@ -326,13 +351,15 @@
 
     /**
      * Set properties for switch specific behavior
-     * @param name name of property
+     *
+     * @param name  name of property
      * @param value value for name
      */
     void setAttribute(String name, Object value);
 
     /**
      * Set properties for switch specific behavior
+     *
      * @param name name of property
      * @return current value for name or null (if not present)
      */
@@ -345,14 +372,16 @@
 
     /**
      * Update broadcast cache
+     *
      * @param data
      * @return true if there is a cache hit
-     *         false if there is no cache hit.
+     * false if there is no cache hit.
      */
     public boolean updateBroadcastCache(Long entry, Short port);
-    
+
     /**
      * Get the portBroadcastCacheHits
+     *
      * @return
      */
     public Map<Short, Long> getPortBroadcastHits();
@@ -360,21 +389,22 @@
     /**
      * Send a flow statistics request to the switch. This call returns after
      * sending the stats. request to the switch.
+     *
      * @param request flow statistics request message
-     * @param xid transaction id, must be obtained by using the getXid() API.
-     * @param caller the caller of the API. receive() callback of this 
-     * caller would be called when the reply from the switch is received.
-     * @return the transaction id for the message sent to the switch. The 
+     * @param xid     transaction id, must be obtained by using the getXid() API.
+     * @param caller  the caller of the API. receive() callback of this
+     *                caller would be called when the reply from the switch is received.
+     * @return the transaction id for the message sent to the switch. The
      * transaction id can be used to match the response with the request. Note
      * that the transaction id is unique only within the scope of this switch.
      * @throws IOException
      */
     public void sendStatsQuery(OFStatisticsRequest request, int xid,
-                            IOFMessageListener caller) throws IOException;
+                               IOFMessageListener caller) throws IOException;
 
     /**
      * Flush all flows queued for this switch in the current thread.
      * NOTE: The contract is limited to the current thread
      */
-     public void flush();
+    public void flush();
 }
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitchFilter.java b/src/main/java/net/floodlightcontroller/core/IOFSwitchFilter.java
index 134ba98..3bb4d10 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitchFilter.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitchFilter.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
index 1bc258b..1a5cd4a 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
@@ -1,25 +1,23 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core;
 
 /**
- *
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public interface IOFSwitchListener {
@@ -27,24 +25,27 @@
     /**
      * Fired when a switch is connected to the controller, and has sent
      * a features reply.
+     *
      * @param sw
      */
     public void addedSwitch(IOFSwitch sw);
 
     /**
      * Fired when a switch is disconnected from the controller.
+     *
      * @param sw
      */
     public void removedSwitch(IOFSwitch sw);
-    
+
     /**
      * Fired when ports on a switch change (any change to the collection
      * of OFPhysicalPorts and/or to a particular port)
      */
     public void switchPortChanged(Long switchId);
-    
+
     /**
      * The name assigned to this listener
+     *
      * @return
      */
     public String getName();
diff --git a/src/main/java/net/floodlightcontroller/core/IUpdate.java b/src/main/java/net/floodlightcontroller/core/IUpdate.java
index 950bc0f..f0f866d 100644
--- a/src/main/java/net/floodlightcontroller/core/IUpdate.java
+++ b/src/main/java/net/floodlightcontroller/core/IUpdate.java
@@ -1,8 +1,8 @@
 package net.floodlightcontroller.core;
 
 public interface IUpdate {
-	
-    /** 
+
+    /**
      * Calls the appropriate listeners
      */
     public void dispatch();
diff --git a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageCategory.java b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageCategory.java
index e9abf02..37f850b 100644
--- a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageCategory.java
+++ b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageCategory.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.annotations;
 
@@ -22,12 +22,14 @@
 
 /**
  * Annotation used to set the category for log messages for a class
+ *
  * @author readams
  */
 @Target({ElementType.TYPE, ElementType.METHOD})
 public @interface LogMessageCategory {
     /**
      * The category for the log messages for this class
+     *
      * @return
      */
     String value() default "Core";
diff --git a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDoc.java b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDoc.java
index 80af1a7..6b5d6b8 100644
--- a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDoc.java
+++ b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDoc.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.annotations;
 
@@ -23,48 +23,56 @@
 /**
  * Annotation used to document log messages.  This can be used to generate
  * documentation on syslog output.
+ *
  * @author readams
  */
 @Target({ElementType.TYPE, ElementType.METHOD})
 public @interface LogMessageDoc {
     public static final String NO_ACTION = "No action is required.";
     public static final String UNKNOWN_ERROR = "An unknown error occured";
-    public static final String GENERIC_ACTION = 
+    public static final String GENERIC_ACTION =
             "Examine the returned error or exception and take " +
-            "appropriate action.";
-    public static final String CHECK_SWITCH = 
-            "Check the health of the indicated switch.  " + 
-            "Test and troubleshoot IP connectivity.";
-    public static final String CHECK_CONTROLLER = 
-            "Verify controller system health, CPU usage, and memory.  " + 
-            "Rebooting the controller node may help if the controller " +
-            "node is in a distressed state.";
+                    "appropriate action.";
+    public static final String CHECK_SWITCH =
+            "Check the health of the indicated switch.  " +
+                    "Test and troubleshoot IP connectivity.";
+    public static final String CHECK_CONTROLLER =
+            "Verify controller system health, CPU usage, and memory.  " +
+                    "Rebooting the controller node may help if the controller " +
+                    "node is in a distressed state.";
     public static final String REPORT_CONTROLLER_BUG =
             "This is likely a defect in the controller.  Please report this " +
-            "issue.  Restarting the controller or switch may help to " +
-            "alleviate.";
+                    "issue.  Restarting the controller or switch may help to " +
+                    "alleviate.";
     public static final String REPORT_SWITCH_BUG =
             "This is likely a defect in the switch.  Please report this " +
-            "issue.  Restarting the controller or switch may help to " +
-            "alleviate.";
+                    "issue.  Restarting the controller or switch may help to " +
+                    "alleviate.";
 
     /**
      * The log level for the log message
+     *
      * @return the log level as a tring
      */
     String level() default "INFO";
+
     /**
      * The message that will be printed
+     *
      * @return the message
      */
     String message() default UNKNOWN_ERROR;
+
     /**
      * An explanation of the meaning of the log message
+     *
      * @return the explanation
      */
     String explanation() default UNKNOWN_ERROR;
+
     /**
      * The recommendated action associated with the log message
+     *
      * @return the recommendation
      */
     String recommendation() default NO_ACTION;
diff --git a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDocs.java b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDocs.java
index 663baf0..aeedf4d 100644
--- a/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDocs.java
+++ b/src/main/java/net/floodlightcontroller/core/annotations/LogMessageDocs.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.annotations;
 
@@ -24,12 +24,14 @@
  * Annotation used to document log messages.  This can be used to generate
  * documentation on syslog output.  This version allows multiple log messages
  * to be documentated on an interface.
+ *
  * @author readams
  */
 @Target({ElementType.TYPE, ElementType.METHOD})
 public @interface LogMessageDocs {
     /**
      * A list of {@link LogMessageDoc} elements
+     *
      * @return the list of log message doc
      */
     LogMessageDoc[] value();
diff --git a/src/main/java/net/floodlightcontroller/core/internal/CmdLineSettings.java b/src/main/java/net/floodlightcontroller/core/internal/CmdLineSettings.java
index 7641a7c..d2d74c4 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/CmdLineSettings.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/CmdLineSettings.java
@@ -8,10 +8,10 @@
 public class CmdLineSettings {
     public static final String DEFAULT_CONFIG_FILE = "config/floodlight.properties";
 
-    @Option(name="-cf", aliases="--configFile", metaVar="FILE", usage="Floodlight configuration file")
+    @Option(name = "-cf", aliases = "--configFile", metaVar = "FILE", usage = "Floodlight configuration file")
     private String configFile = DEFAULT_CONFIG_FILE;
-    
+
     public String getModuleFile() {
-    	return configFile;
+        return configFile;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index d475fa6..74f0802 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -124,26 +124,26 @@
 
 /**
  * The main controller class.  Handles all setup and network listeners
- * 
+ * <p/>
  * Extensions made by ONOS are:
- * - Detailed Port event: PORTCHANGED -> {PORTCHANGED, PORTADDED, PORTREMOVED} 
- *    Available as net.onrc.onos.core.main.IOFSwitchPortListener
+ * - Detailed Port event: PORTCHANGED -> {PORTCHANGED, PORTADDED, PORTREMOVED}
+ * Available as net.onrc.onos.core.main.IOFSwitchPortListener
  * - Distributed ownership control of switch through RegistryService(IControllerRegistryService)
  * - Register ONOS services. (IControllerRegistryService)
  * - Additional DEBUG logs
  * - Try using hostname as controller ID, when ID was not explicitly given.
  */
 public class Controller implements IFloodlightProviderService {
-    
+
     protected final static Logger log = LoggerFactory.getLogger(Controller.class);
 
-    private static final String ERROR_DATABASE = 
+    private static final String ERROR_DATABASE =
             "The controller could not communicate with the system database.";
-    
+
     protected BasicFactory factory;
     protected ConcurrentMap<OFType,
-                            ListenerDispatcher<OFType,IOFMessageListener>> 
-                                messageListeners;
+            ListenerDispatcher<OFType, IOFMessageListener>>
+            messageListeners;
     // The activeSwitches map contains only those switches that are actively
     // being controlled by us -- it doesn't contain switches that are
     // in the slave role
@@ -154,45 +154,45 @@
     // We add a switch to this set after it successfully completes the
     // handshake. Access to this Set needs to be synchronized with roleChanger
     protected HashSet<OFSwitchImpl> connectedSwitches;
-    
+
     // The controllerNodeIPsCache maps Controller IDs to their IP address. 
     // It's only used by handleControllerNodeIPsChanged
     protected HashMap<String, String> controllerNodeIPsCache;
-    
+
     protected Set<IOFSwitchListener> switchListeners;
     protected BlockingQueue<IUpdate> updates;
-    
+
     // Module dependencies
     protected IRestApiService restApi;
     protected IThreadPoolService threadPool;
     protected IControllerRegistryService registryService;
-    
+
     protected ILinkDiscoveryService linkDiscovery;
-    
+
     // Configuration options
     protected int openFlowPort = 6633;
     protected int workerThreads = 0;
     // The id for this controller node. Should be unique for each controller
     // node in a controller cluster.
     protected String controllerId = "localhost";
-    
+
     // The current role of the controller.
     // If the controller isn't configured to support roles, then this is null.
     protected Role role;
     // A helper that handles sending and timeout handling for role requests
     protected RoleChanger roleChanger;
-    
+
     // Start time of the controller
     protected long systemStartTime;
-    
+
     // Flag to always flush flow table on switch reconnect (HA or otherwise)
     protected boolean alwaysClearFlowsOnSwAdd = false;
-    
+
     // Perf. related configuration
     protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
     protected static final int BATCH_MAX_SIZE = 100;
-	protected static final boolean ALWAYS_DECODE_ETH = true;
-  
+    protected static final boolean ALWAYS_DECODE_ETH = true;
+
     public enum SwitchUpdateType {
         ADDED,
         REMOVED,
@@ -200,24 +200,27 @@
         PORTADDED,
         PORTREMOVED
     }
-    
+
     /**
-     * Update message indicating a switch was added or removed 
+     * Update message indicating a switch was added or removed
      * ONOS: This message extended to indicate Port add or removed event.
      */
     protected class SwitchUpdate implements IUpdate {
         public IOFSwitch sw;
         public OFPhysicalPort port; // Added by ONOS
         public SwitchUpdateType switchUpdateType;
+
         public SwitchUpdate(IOFSwitch sw, SwitchUpdateType switchUpdateType) {
             this.sw = sw;
             this.switchUpdateType = switchUpdateType;
         }
+
         public SwitchUpdate(IOFSwitch sw, OFPhysicalPort port, SwitchUpdateType switchUpdateType) {
             this.sw = sw;
             this.port = port;
             this.switchUpdateType = switchUpdateType;
         }
+
         public void dispatch() {
             if (log.isTraceEnabled()) {
                 log.trace("Dispatching switch update {} {}",
@@ -225,7 +228,7 @@
             }
             if (switchListeners != null) {
                 for (IOFSwitchListener listener : switchListeners) {
-                    switch(switchUpdateType) {
+                    switch (switchUpdateType) {
                         case ADDED:
                             listener.addedSwitch(sw);
                             break;
@@ -236,138 +239,139 @@
                             listener.switchPortChanged(sw.getId());
                             break;
                         case PORTADDED:
-                        	if (listener instanceof IOFSwitchPortListener) {
-                        		((IOFSwitchPortListener) listener).switchPortAdded(sw.getId(), port);
-                        	}
-                        	break;
+                            if (listener instanceof IOFSwitchPortListener) {
+                                ((IOFSwitchPortListener) listener).switchPortAdded(sw.getId(), port);
+                            }
+                            break;
                         case PORTREMOVED:
-                        	if (listener instanceof IOFSwitchPortListener) {
-                        		((IOFSwitchPortListener) listener).switchPortRemoved(sw.getId(), port);
-                        	}
-                        	break;
+                            if (listener instanceof IOFSwitchPortListener) {
+                                ((IOFSwitchPortListener) listener).switchPortRemoved(sw.getId(), port);
+                            }
+                            break;
                         default:
-                        	break;
+                            break;
                     }
                 }
             }
         }
     }
-    
+
     // ***************
     // Getters/Setters
     // *************** 
-    
+
     public void setRestApiService(IRestApiService restApi) {
         this.restApi = restApi;
     }
-    
+
     public void setThreadPoolService(IThreadPoolService tp) {
         this.threadPool = tp;
     }
 
-	public void setMastershipService(IControllerRegistryService serviceImpl) {
-		this.registryService = serviceImpl;		
-	}
-	
-	public void setLinkDiscoveryService(ILinkDiscoveryService linkDiscovery) {
-		this.linkDiscovery = linkDiscovery;
-	}
-    
-    public void publishUpdate(IUpdate update) {
-    	try {
-			this.updates.put(update);
-		} catch (InterruptedException e) {
-			log.error("Failure adding update to queue", e);
-		}
+    public void setMastershipService(IControllerRegistryService serviceImpl) {
+        this.registryService = serviceImpl;
     }
-    
+
+    public void setLinkDiscoveryService(ILinkDiscoveryService linkDiscovery) {
+        this.linkDiscovery = linkDiscovery;
+    }
+
+    public void publishUpdate(IUpdate update) {
+        try {
+            this.updates.put(update);
+        } catch (InterruptedException e) {
+            log.error("Failure adding update to queue", e);
+        }
+    }
+
     // **********************
     // ChannelUpstreamHandler
     // **********************
-    
+
     /**
      * Return a new channel handler for processing a switch connections
+     *
      * @param state The channel state object for the connection
      * @return the new channel handler
      */
     protected ChannelUpstreamHandler getChannelHandler(OFChannelState state) {
         return new OFChannelHandler(state);
     }
-    
+
     protected class RoleChangeCallback implements ControlChangeCallback {
-		@Override
-		public void controlChanged(long dpid, boolean hasControl) {
-			log.info("Role change callback for switch {}, hasControl {}", 
-					HexString.toHexString(dpid), hasControl);
-			
-			synchronized(roleChanger){
-				OFSwitchImpl sw = null;
-				for (OFSwitchImpl connectedSw : connectedSwitches){
-					if (connectedSw.getId() == dpid){
-						sw = connectedSw;
-						break;
-					}
-				}
-				if (sw == null){
-					log.warn("Switch {} not found in connected switches",
-							HexString.toHexString(dpid));
-					return;
-				}
-				
-				Role role = null;
-				
-				/*
-				 * issue #229
-				 * Cannot rely on sw.getRole() as it can be behind due to pending
-				 * role changes in the queue. Just submit it and late the RoleChanger
-				 * handle duplicates.
-				 */
+        @Override
+        public void controlChanged(long dpid, boolean hasControl) {
+            log.info("Role change callback for switch {}, hasControl {}",
+                    HexString.toHexString(dpid), hasControl);
 
-				if (hasControl){
-					role = Role.MASTER;
-				}
-				else {
-					role = Role.SLAVE;
-				}
+            synchronized (roleChanger) {
+                OFSwitchImpl sw = null;
+                for (OFSwitchImpl connectedSw : connectedSwitches) {
+                    if (connectedSw.getId() == dpid) {
+                        sw = connectedSw;
+                        break;
+                    }
+                }
+                if (sw == null) {
+                    log.warn("Switch {} not found in connected switches",
+                            HexString.toHexString(dpid));
+                    return;
+                }
 
-				log.debug("Sending role request {} msg to {}", role, sw);
-				Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
-				swList.add(sw);
-				roleChanger.submitRequest(swList, role);
+                Role role = null;
+                                
+                                /*
+                                 * issue #229
+                                 * Cannot rely on sw.getRole() as it can be behind due to pending
+                                 * role changes in the queue. Just submit it and late the RoleChanger
+                                 * handle duplicates.
+                                 */
 
-			}
-			
-		}
+                if (hasControl) {
+                    role = Role.MASTER;
+                } else {
+                    role = Role.SLAVE;
+                }
+
+                log.debug("Sending role request {} msg to {}", role, sw);
+                Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
+                swList.add(sw);
+                roleChanger.submitRequest(swList, role);
+
+            }
+
+        }
     }
-    
+
     /**
      * Channel handler deals with the switch connection and dispatches
      * switch messages to the appropriate locations.
+     *
      * @author readams
      */
-    protected class OFChannelHandler 
-        extends IdleStateAwareChannelUpstreamHandler {
+    protected class OFChannelHandler
+            extends IdleStateAwareChannelUpstreamHandler {
         protected OFSwitchImpl sw;
         protected OFChannelState state;
-        
+
         public OFChannelHandler(OFChannelState state) {
             this.state = state;
         }
 
         @Override
-        @LogMessageDoc(message="New switch connection from {ip address}",
-                       explanation="A new switch has connected from the " + 
-                                "specified IP address")
+        @LogMessageDoc(message = "New switch connection from {ip address}",
+                explanation = "A new switch has connected from the " +
+                        "specified IP address")
         public void channelConnected(ChannelHandlerContext ctx,
                                      ChannelStateEvent e) throws Exception {
             log.info("New switch connection from {}",
-                     e.getChannel().getRemoteAddress());
-            
+                    e.getChannel().getRemoteAddress());
+
             sw = new OFSwitchImpl();
             sw.setChannel(e.getChannel());
             sw.setFloodlightProvider(Controller.this);
             sw.setThreadPoolService(threadPool);
-            
+
             List<OFMessage> msglist = new ArrayList<OFMessage>(1);
             msglist.add(factory.getMessage(OFType.HELLO));
             e.getChannel().write(msglist);
@@ -375,8 +379,8 @@
         }
 
         @Override
-        @LogMessageDoc(message="Disconnected switch {switch information}",
-                       explanation="The specified switch has disconnected.")
+        @LogMessageDoc(message = "Disconnected switch {switch information}",
+                explanation = "The specified switch has disconnected.")
         public void channelDisconnected(ChannelHandlerContext ctx,
                                         ChannelStateEvent e) throws Exception {
             if (sw != null && state.hsState == HandshakeState.READY) {
@@ -386,10 +390,10 @@
                     // same DPID
                     removeSwitch(sw);
                 }
-                synchronized(roleChanger) {
-                	if (controlRequested) {
-                		registryService.releaseControl(sw.getId());
-                	}
+                synchronized (roleChanger) {
+                    if (controlRequested) {
+                        registryService.releaseControl(sw.getId());
+                    }
                     connectedSwitches.remove(sw);
                 }
                 sw.setConnected(false);
@@ -399,41 +403,41 @@
 
         @Override
         @LogMessageDocs({
-            @LogMessageDoc(level="ERROR",
-                    message="Disconnecting switch {switch} due to read timeout",
-                    explanation="The connected switch has failed to send any " + 
+                @LogMessageDoc(level = "ERROR",
+                        message = "Disconnecting switch {switch} due to read timeout",
+                        explanation = "The connected switch has failed to send any " +
                                 "messages or respond to echo requests",
-                    recommendation=LogMessageDoc.CHECK_SWITCH),
-            @LogMessageDoc(level="ERROR",
-                    message="Disconnecting switch {switch}: failed to " + 
-                            "complete handshake",
-                    explanation="The switch did not respond correctly " + 
+                        recommendation = LogMessageDoc.CHECK_SWITCH),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Disconnecting switch {switch}: failed to " +
+                                "complete handshake",
+                        explanation = "The switch did not respond correctly " +
                                 "to handshake messages",
-                    recommendation=LogMessageDoc.CHECK_SWITCH),
-            @LogMessageDoc(level="ERROR",
-                    message="Disconnecting switch {switch} due to IO Error: {}",
-                    explanation="There was an error communicating with the switch",
-                    recommendation=LogMessageDoc.CHECK_SWITCH),
-            @LogMessageDoc(level="ERROR",
-                    message="Disconnecting switch {switch} due to switch " + 
-                            "state error: {error}",
-                    explanation="The switch sent an unexpected message",
-                    recommendation=LogMessageDoc.CHECK_SWITCH),
-            @LogMessageDoc(level="ERROR",
-                    message="Disconnecting switch {switch} due to " +
-                            "message parse failure",
-                    explanation="Could not parse a message from the switch",
-                    recommendation=LogMessageDoc.CHECK_SWITCH),
-            @LogMessageDoc(level="ERROR",
-                    message="Could not process message: queue full",
-                    explanation="OpenFlow messages are arriving faster than " +
+                        recommendation = LogMessageDoc.CHECK_SWITCH),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Disconnecting switch {switch} due to IO Error: {}",
+                        explanation = "There was an error communicating with the switch",
+                        recommendation = LogMessageDoc.CHECK_SWITCH),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Disconnecting switch {switch} due to switch " +
+                                "state error: {error}",
+                        explanation = "The switch sent an unexpected message",
+                        recommendation = LogMessageDoc.CHECK_SWITCH),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Disconnecting switch {switch} due to " +
+                                "message parse failure",
+                        explanation = "Could not parse a message from the switch",
+                        recommendation = LogMessageDoc.CHECK_SWITCH),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Could not process message: queue full",
+                        explanation = "OpenFlow messages are arriving faster than " +
                                 " the controller can process them.",
-                    recommendation=LogMessageDoc.CHECK_CONTROLLER),
-            @LogMessageDoc(level="ERROR",
-                    message="Error while processing message " +
-                            "from switch {switch} {cause}",
-                    explanation="An error occurred processing the switch message",
-                    recommendation=LogMessageDoc.GENERIC_ACTION)
+                        recommendation = LogMessageDoc.CHECK_CONTROLLER),
+                @LogMessageDoc(level = "ERROR",
+                        message = "Error while processing message " +
+                                "from switch {switch} {cause}",
+                        explanation = "An error occurred processing the switch message",
+                        recommendation = LogMessageDoc.GENERIC_ACTION)
         })
         public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
                 throws Exception {
@@ -442,29 +446,29 @@
                 log.error("Disconnecting switch {} due to read timeout", sw);
                 ctx.getChannel().close();
             } else if (e.getCause() instanceof HandshakeTimeoutException) {
-                log.error("Disconnecting switch {}: failed to complete handshake", 
-                          sw);
+                log.error("Disconnecting switch {}: failed to complete handshake",
+                        sw);
                 ctx.getChannel().close();
             } else if (e.getCause() instanceof ClosedChannelException) {
                 //log.warn("Channel for sw {} already closed", sw);
             } else if (e.getCause() instanceof IOException) {
                 log.error("Disconnecting switch {} due to IO Error: {}",
-                          sw, e.getCause().getMessage());
+                        sw, e.getCause().getMessage());
                 ctx.getChannel().close();
             } else if (e.getCause() instanceof SwitchStateException) {
-                log.error("Disconnecting switch {} due to switch state error: {}", 
-                          sw, e.getCause().getMessage());
+                log.error("Disconnecting switch {} due to switch state error: {}",
+                        sw, e.getCause().getMessage());
                 ctx.getChannel().close();
             } else if (e.getCause() instanceof MessageParseException) {
                 log.error("Disconnecting switch " + sw +
-                          " due to message parse failure", 
-                          e.getCause());
+                        " due to message parse failure",
+                        e.getCause());
                 ctx.getChannel().close();
             } else if (e.getCause() instanceof RejectedExecutionException) {
                 log.warn("Could not process message: queue full");
             } else {
                 log.error("Error while processing message from switch " + sw,
-                          e.getCause());
+                        e.getCause());
                 ctx.getChannel().close();
             }
         }
@@ -482,13 +486,12 @@
                 throws Exception {
             if (e.getMessage() instanceof List) {
                 @SuppressWarnings("unchecked")
-                List<OFMessage> msglist = (List<OFMessage>)e.getMessage();
+                List<OFMessage> msglist = (List<OFMessage>) e.getMessage();
 
                 for (OFMessage ofm : msglist) {
                     try {
                         processOFMessage(ofm);
-                    }
-                    catch (Exception ex) {
+                    } catch (Exception ex) {
                         // We are the last handler in the stream, so run the 
                         // exception through the channel again by passing in 
                         // ctx.getChannel().
@@ -500,78 +503,78 @@
                 OFSwitchImpl.flush_all();
             }
         }
-        
+
         /**
          * Process the request for the switch description
          */
-        @LogMessageDoc(level="ERROR",
-                message="Exception in reading description " + 
+        @LogMessageDoc(level = "ERROR",
+                message = "Exception in reading description " +
                         " during handshake {exception}",
-                explanation="Could not process the switch description string",
-                recommendation=LogMessageDoc.CHECK_SWITCH)
+                explanation = "Could not process the switch description string",
+                recommendation = LogMessageDoc.CHECK_SWITCH)
         void processSwitchDescReply() {
             try {
                 // Read description, if it has been updated
                 @SuppressWarnings("unchecked")
                 Future<List<OFStatistics>> desc_future =
-                    (Future<List<OFStatistics>>)sw.
-                        getAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE);
-                List<OFStatistics> values = 
+                        (Future<List<OFStatistics>>) sw.
+                                getAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE);
+                List<OFStatistics> values =
                         desc_future.get(0, TimeUnit.MILLISECONDS);
                 if (values != null) {
-                    OFDescriptionStatistics description = 
+                    OFDescriptionStatistics description =
                             new OFDescriptionStatistics();
-                    ChannelBuffer data = 
+                    ChannelBuffer data =
                             ChannelBuffers.buffer(description.getLength());
                     for (OFStatistics f : values) {
                         f.writeTo(data);
                         description.readFrom(data);
                         break; // SHOULD be a list of length 1
                     }
-                    sw.setAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA, 
-                                    description);
+                    sw.setAttribute(IOFSwitch.SWITCH_DESCRIPTION_DATA,
+                            description);
                     sw.setSwitchProperties(description);
                     data = null;
                 }
-                
+
                 sw.removeAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE);
                 state.hasDescription = true;
                 checkSwitchReady();
-            }
-            catch (InterruptedException ex) {
+            } catch (InterruptedException ex) {
                 // Ignore
-            }
-            catch (TimeoutException ex) {
+            } catch (TimeoutException ex) {
                 // Ignore
             } catch (Exception ex) {
-                log.error("Exception in reading description " + 
-                          " during handshake", ex);
+                log.error("Exception in reading description " +
+                        " during handshake", ex);
             }
         }
 
         /**
          * Send initial switch setup information that we need before adding
          * the switch
+         *
          * @throws IOException
          */
         void sendHelloConfiguration() throws IOException {
             // Send initial Features Request
-        	log.debug("Sending FEATURES_REQUEST to {}", sw);
+            log.debug("Sending FEATURES_REQUEST to {}", sw);
             sw.write(factory.getMessage(OFType.FEATURES_REQUEST), null);
         }
-        
+
         /**
          * Send the configuration requests we can only do after we have
          * the features reply
+         *
          * @throws IOException
          */
         void sendFeatureReplyConfiguration() throws IOException {
-        	log.debug("Sending CONFIG_REQUEST to {}", sw);
+            log.debug("Sending CONFIG_REQUEST to {}", sw);
             // Ensure we receive the full packet via PacketIn
             OFSetConfig config = (OFSetConfig) factory
                     .getMessage(OFType.SET_CONFIG);
             config.setMissSendLength((short) 0xffff)
-            .setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
+                    .setLengthU(OFSwitchConfig.MINIMUM_LENGTH);
             sw.write(config, null);
             sw.write(factory.getMessage(OFType.GET_CONFIG_REQUEST),
                     null);
@@ -580,22 +583,23 @@
             OFStatisticsRequest req = new OFStatisticsRequest();
             req.setStatisticType(OFStatisticsType.DESC);
             req.setLengthU(req.getLengthU());
-            Future<List<OFStatistics>> dfuture = 
+            Future<List<OFStatistics>> dfuture =
                     sw.getStatistics(req);
             sw.setAttribute(IOFSwitch.SWITCH_DESCRIPTION_FUTURE,
                     dfuture);
 
         }
-        
-      	volatile Boolean controlRequested = Boolean.FALSE;
+
+        volatile Boolean controlRequested = Boolean.FALSE;
+
         protected void checkSwitchReady() {
             if (state.hsState == HandshakeState.FEATURES_REPLY &&
                     state.hasDescription && state.hasGetConfigReply) {
-                
+
                 state.hsState = HandshakeState.READY;
                 log.debug("Handshake with {} complete", sw);
-                
-                synchronized(roleChanger) {
+
+                synchronized (roleChanger) {
                     // We need to keep track of all of the switches that are connected
                     // to the controller, in any role, so that we can later send the 
                     // role request messages when the controller role changes.
@@ -604,26 +608,25 @@
                     // we were able to add this new switch to connectedSwitches 
                     // *and* send the current role to the new switch.
                     connectedSwitches.add(sw);
-                    
+
                     if (role != null) {
-                    	//Put the switch in SLAVE mode until we know we have control
-                    	log.debug("Setting new switch {} to SLAVE", sw.getStringId());
-                    	Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
-                    	swList.add(sw);
-                    	roleChanger.submitRequest(swList, Role.SLAVE);
-                    	
-                    	//Request control of the switch from the global registry
-                    	try {
-                    		controlRequested = Boolean.TRUE;
-							registryService.requestControl(sw.getId(), 
-									new RoleChangeCallback());
-						} catch (RegistryException e) {
-							log.debug("Registry error: {}", e.getMessage());
-							controlRequested = Boolean.FALSE;
-						}
-                    	
-                    	
-                    	
+                        //Put the switch in SLAVE mode until we know we have control
+                        log.debug("Setting new switch {} to SLAVE", sw.getStringId());
+                        Collection<OFSwitchImpl> swList = new ArrayList<OFSwitchImpl>(1);
+                        swList.add(sw);
+                        roleChanger.submitRequest(swList, Role.SLAVE);
+
+                        //Request control of the switch from the global registry
+                        try {
+                            controlRequested = Boolean.TRUE;
+                            registryService.requestControl(sw.getId(),
+                                    new RoleChangeCallback());
+                        } catch (RegistryException e) {
+                            log.debug("Registry error: {}", e.getMessage());
+                            controlRequested = Boolean.FALSE;
+                        }
+
+
                         // Send a role request if role support is enabled for the controller
                         // This is a probe that we'll use to determine if the switch
                         // actually supports the role request message. If it does we'll
@@ -639,11 +642,10 @@
                         swList.add(sw);
                         roleChanger.submitRequest(swList, role);
                         */
-                    } 
-                    else {
+                    } else {
                         // Role supported not enabled on controller (for now)
                         // automatically promote switch to active state. 
-                        log.debug("This controller's role is {}, " + 
+                        log.debug("This controller's role is {}, " +
                                 "not sending role request msg to {}",
                                 role, sw);
                         // Need to clear FlowMods before we add the switch
@@ -654,20 +656,20 @@
                     }
                 }
                 if (!controlRequested) {
-                	// yield to allow other thread(s) to release control
-                	try {
-						Thread.sleep(10);
-					} catch (InterruptedException e) {
-						// Ignore interruptions						
-					}
-                	// safer to bounce the switch to reconnect here than proceeding further
-                	log.debug("Closing {} because we weren't able to request control " +
-                			"successfully" + sw);
-                	sw.channel.close();
+                    // yield to allow other thread(s) to release control
+                    try {
+                        Thread.sleep(10);
+                    } catch (InterruptedException e) {
+                        // Ignore interruptions
+                    }
+                    // safer to bounce the switch to reconnect here than proceeding further
+                    log.debug("Closing {} because we weren't able to request control " +
+                            "successfully" + sw);
+                    sw.channel.close();
                 }
             }
         }
-                
+
         /* Handle a role reply message we received from the switch. Since
          * netty serializes message dispatch we don't need to synchronize 
          * against other receive operations from the same switch, so no need
@@ -679,13 +681,13 @@
          * removedSwitch notification):1
          * 
          */
-        @LogMessageDoc(level="ERROR",
-                message="Invalid role value in role reply message",
-                explanation="Was unable to set the HA role (master or slave) " +
+        @LogMessageDoc(level = "ERROR",
+                message = "Invalid role value in role reply message",
+                explanation = "Was unable to set the HA role (master or slave) " +
                         "for the controller.",
-                recommendation=LogMessageDoc.CHECK_CONTROLLER)
+                recommendation = LogMessageDoc.CHECK_CONTROLLER)
         protected void handleRoleReplyMessage(OFVendor vendorMessage,
-                                    OFRoleReplyVendorData roleReplyVendorData) {
+                                              OFRoleReplyVendorData roleReplyVendorData) {
             // Map from the role code in the message to our role enum
             int nxRole = roleReplyVendorData.getRole();
             Role role = null;
@@ -704,20 +706,20 @@
                     sw.getChannel().close();
                     return;
             }
-            
+
             log.debug("Handling role reply for role {} from {}. " +
-                      "Controller's role is {} ", 
-                      new Object[] { role, sw, Controller.this.role} 
-                      );
-            
+                    "Controller's role is {} ",
+                    new Object[]{role, sw, Controller.this.role}
+            );
+
             sw.deliverRoleReply(vendorMessage.getXid(), role);
-            
+
             boolean isActive = activeSwitches.containsKey(sw.getId());
             if (!isActive && sw.isActive()) {
                 // Transition from SLAVE to MASTER.
-                
-                if (!state.firstRoleReplyReceived || 
-                    getAlwaysClearFlowsOnSwAdd()) {
+
+                if (!state.firstRoleReplyReceived ||
+                        getAlwaysClearFlowsOnSwAdd()) {
                     // This is the first role-reply message we receive from
                     // this switch or roles were disabled when the switch
                     // connected: 
@@ -740,14 +742,14 @@
                     // flushed. Not sure how to handle that case though...
                     sw.clearAllFlowMods();
                     log.debug("First role reply from master switch {}, " +
-                              "clear FlowTable to active switch list",
-                             HexString.toHexString(sw.getId()));
+                            "clear FlowTable to active switch list",
+                            HexString.toHexString(sw.getId()));
                 }
-                
+
                 // Some switches don't seem to update us with port
                 // status messages while in slave role.
                 //readSwitchPortStateFromStorage(sw);                
-                
+
                 // Only add the switch to the active switch list if 
                 // we're not in the slave role. Note that if the role 
                 // attribute is null, then that means that the switch 
@@ -756,17 +758,16 @@
                 // switch should be included in the active switch list.
                 addSwitch(sw);
                 log.debug("Added master switch {} to active switch list",
-                         HexString.toHexString(sw.getId()));
+                        HexString.toHexString(sw.getId()));
 
-            } 
-            else if (isActive && !sw.isActive()) {
+            } else if (isActive && !sw.isActive()) {
                 // Transition from MASTER to SLAVE: remove switch 
                 // from active switch list. 
                 log.debug("Removed slave switch {} from active switch" +
-                          " list", HexString.toHexString(sw.getId()));
+                        " list", HexString.toHexString(sw.getId()));
                 removeSwitch(sw);
             }
-            
+
             // Indicate that we have received a role reply message. 
             state.firstRoleReplyReceived = true;
         }
@@ -777,18 +778,18 @@
             switch (vendor) {
                 case OFNiciraVendorData.NX_VENDOR_ID:
                     OFNiciraVendorData niciraVendorData =
-                        (OFNiciraVendorData)vendorMessage.getVendorData();
+                            (OFNiciraVendorData) vendorMessage.getVendorData();
                     int dataType = niciraVendorData.getDataType();
                     switch (dataType) {
                         case OFRoleReplyVendorData.NXT_ROLE_REPLY:
                             OFRoleReplyVendorData roleReplyVendorData =
                                     (OFRoleReplyVendorData) niciraVendorData;
-                            handleRoleReplyMessage(vendorMessage, 
-                                                   roleReplyVendorData);
+                            handleRoleReplyMessage(vendorMessage,
+                                    roleReplyVendorData);
                             break;
                         default:
                             log.warn("Unhandled Nicira VENDOR message; " +
-                                     "data type = {}", dataType);
+                                    "data type = {}", dataType);
                             break;
                     }
                     break;
@@ -796,54 +797,55 @@
                     log.warn("Unhandled VENDOR message; vendor id = {}", vendor);
                     break;
             }
-            
+
             return shouldHandleMessage;
         }
 
         /**
          * Dispatch an Openflow message from a switch to the appropriate
          * handler.
+         *
          * @param m The message to process
          * @throws IOException
-         * @throws SwitchStateException 
+         * @throws SwitchStateException
          */
         @LogMessageDocs({
-            @LogMessageDoc(level="WARN",
-                    message="Config Reply from {switch} has " +
-                            "miss length set to {length}",
-                    explanation="The controller requires that the switch " +
-                            "use a miss length of 0xffff for correct " +
-                            "function",
-                    recommendation="Use a different switch to ensure " +
-                            "correct function"),
-            @LogMessageDoc(level="WARN",
-                    message="Received ERROR from sw {switch} that "
-                            +"indicates roles are not supported "
-                            +"but we have received a valid "
-                            +"role reply earlier",
-                    explanation="The switch sent a confusing message to the" +
-                            "controller")
+                @LogMessageDoc(level = "WARN",
+                        message = "Config Reply from {switch} has " +
+                                "miss length set to {length}",
+                        explanation = "The controller requires that the switch " +
+                                "use a miss length of 0xffff for correct " +
+                                "function",
+                        recommendation = "Use a different switch to ensure " +
+                                "correct function"),
+                @LogMessageDoc(level = "WARN",
+                        message = "Received ERROR from sw {switch} that "
+                                + "indicates roles are not supported "
+                                + "but we have received a valid "
+                                + "role reply earlier",
+                        explanation = "The switch sent a confusing message to the" +
+                                "controller")
         })
         protected void processOFMessage(OFMessage m)
                 throws IOException, SwitchStateException {
             boolean shouldHandleMessage = false;
-            
+
             switch (m.getType()) {
                 case HELLO:
                     if (log.isTraceEnabled())
                         log.trace("HELLO from {}", sw);
-                    
+
                     if (state.hsState.equals(HandshakeState.START)) {
                         state.hsState = HandshakeState.HELLO;
                         sendHelloConfiguration();
                     } else {
-                        throw new SwitchStateException("Unexpected HELLO from " 
-                                                       + sw);
+                        throw new SwitchStateException("Unexpected HELLO from "
+                                + sw);
                     }
                     break;
                 case ECHO_REQUEST:
                     OFEchoReply reply =
-                        (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY);
+                            (OFEchoReply) factory.getMessage(OFType.ECHO_REPLY);
                     reply.setXid(m.getXid());
                     sw.write(reply, null);
                     break;
@@ -852,7 +854,7 @@
                 case FEATURES_REPLY:
                     if (log.isTraceEnabled())
                         log.trace("Features Reply from {}", sw);
-                    
+
                     sw.setFeaturesReply((OFFeaturesReply) m);
                     if (state.hsState.equals(HandshakeState.HELLO)) {
                         sendFeatureReplyConfiguration();
@@ -870,28 +872,28 @@
                 case GET_CONFIG_REPLY:
                     if (log.isTraceEnabled())
                         log.trace("Get config reply from {}", sw);
-                    
+
                     if (!state.hsState.equals(HandshakeState.FEATURES_REPLY)) {
                         String em = "Unexpected GET_CONFIG_REPLY from " + sw;
                         throw new SwitchStateException(em);
                     }
                     OFGetConfigReply cr = (OFGetConfigReply) m;
-                    if (cr.getMissSendLength() == (short)0xffff) {
-                        log.trace("Config Reply from {} confirms " + 
-                                  "miss length set to 0xffff", sw);
+                    if (cr.getMissSendLength() == (short) 0xffff) {
+                        log.trace("Config Reply from {} confirms " +
+                                "miss length set to 0xffff", sw);
                     } else {
                         log.warn("Config Reply from {} has " +
-                                 "miss length set to {}", 
-                                 sw, cr.getMissSendLength() & 0xffff);
+                                "miss length set to {}",
+                                sw, cr.getMissSendLength() & 0xffff);
                     }
                     state.hasGetConfigReply = true;
                     checkSwitchReady();
                     break;
                 case VENDOR:
-                    shouldHandleMessage = handleVendorMessage((OFVendor)m);
+                    shouldHandleMessage = handleVendorMessage((OFVendor) m);
                     break;
                 case ERROR:
-                	log.debug("Recieved ERROR message from switch {}: {}", sw, m);
+                    log.debug("Recieved ERROR message from switch {}: {}", sw, m);
                     // TODO: we need better error handling. Especially for 
                     // request/reply style message (stats, roles) we should have
                     // a unified way to lookup the xid in the error message. 
@@ -903,8 +905,8 @@
                     // i.e., check only whether the first request fails?
                     if (sw.checkFirstPendingRoleRequestXid(error.getXid())) {
                         boolean isBadVendorError =
-                            (error.getErrorType() == OFError.OFErrorType.
-                                    OFPET_BAD_REQUEST.getValue());
+                                (error.getErrorType() == OFError.OFErrorType.
+                                        OFPET_BAD_REQUEST.getValue());
                         // We expect to receive a bad vendor error when 
                         // we're connected to a switch that doesn't support 
                         // the Nicira vendor extensions (i.e. not OVS or 
@@ -915,31 +917,30 @@
                         // is not a spurious error
                         shouldLogError = !isBadVendorError;
                         if (isBadVendorError) {
-                        	log.debug("Handling bad vendor error for {}", sw);
+                            log.debug("Handling bad vendor error for {}", sw);
                             if (state.firstRoleReplyReceived && (role != null)) {
                                 log.warn("Received ERROR from sw {} that "
-                                          +"indicates roles are not supported "
-                                          +"but we have received a valid "
-                                          +"role reply earlier", sw);
+                                        + "indicates roles are not supported "
+                                        + "but we have received a valid "
+                                        + "role reply earlier", sw);
                             }
                             state.firstRoleReplyReceived = true;
-                            Role requestedRole = 
-                            		sw.deliverRoleRequestNotSupportedEx(error.getXid());
-                            synchronized(roleChanger) {
-                                if (sw.role == null && Controller.this.role==Role.SLAVE) {
-                                	//This will now never happen. The Controller's role
-                                	//is now never SLAVE, always MASTER.
+                            Role requestedRole =
+                                    sw.deliverRoleRequestNotSupportedEx(error.getXid());
+                            synchronized (roleChanger) {
+                                if (sw.role == null && Controller.this.role == Role.SLAVE) {
+                                    //This will now never happen. The Controller's role
+                                    //is now never SLAVE, always MASTER.
                                     // the switch doesn't understand role request
                                     // messages and the current controller role is
                                     // slave. We need to disconnect the switch. 
                                     // @see RoleChanger for rationale
-                                	log.warn("Closing {} channel because controller's role " +
-                                			"is SLAVE", sw);
+                                    log.warn("Closing {} channel because controller's role " +
+                                            "is SLAVE", sw);
                                     sw.getChannel().close();
-                                }
-                                else if (sw.role == null && requestedRole == Role.MASTER) {
-                                	log.debug("Adding switch {} because we got an error" +
-                                			" returned from a MASTER role request", sw);
+                                } else if (sw.role == null && requestedRole == Role.MASTER) {
+                                    log.debug("Adding switch {} because we got an error" +
+                                            " returned from a MASTER role request", sw);
                                     // Controller's role is master: add to
                                     // active 
                                     // TODO: check if clearing flow table is
@@ -952,8 +953,7 @@
                                     addSwitch(sw);
                                 }
                             }
-                        }
-                        else {
+                        } else {
                             // TODO: Is this the right thing to do if we receive
                             // some other error besides a bad vendor error? 
                             // Presumably that means the switch did actually
@@ -972,8 +972,8 @@
                             // to make sure that the switch eventually accepts one
                             // of our requests or disconnect the switch. This feels
                             // cumbersome. 
-                        	log.debug("Closing {} channel because we recieved an " + 
-                        			"error other than BAD_VENDOR", sw);
+                            log.debug("Closing {} channel because we recieved an " +
+                                    "error other than BAD_VENDOR", sw);
                             sw.getChannel().close();
                         }
                     }
@@ -984,8 +984,8 @@
                         logError(sw, error);
                     break;
                 case STATS_REPLY:
-                    if (state.hsState.ordinal() < 
-                        HandshakeState.FEATURES_REPLY.ordinal()) {
+                    if (state.hsState.ordinal() <
+                            HandshakeState.FEATURES_REPLY.ordinal()) {
                         String em = "Unexpected STATS_REPLY from " + sw;
                         throw new SwitchStateException(em);
                     }
@@ -999,9 +999,9 @@
                     // the slave role, but we only want to update storage if 
                     // we're the master (or equal).
                     boolean updateStorage = state.hsState.
-                                                equals(HandshakeState.READY) &&
-                                                (sw.getRole() != Role.SLAVE);
-                    handlePortStatusMessage(sw, (OFPortStatus)m, updateStorage);
+                            equals(HandshakeState.READY) &&
+                            (sw.getRole() != Role.SLAVE);
+                    handlePortStatusMessage(sw, (OFPortStatus) m, updateStorage);
                     shouldHandleMessage = true;
                     break;
 
@@ -1009,15 +1009,15 @@
                     shouldHandleMessage = true;
                     break;
             }
-            
+
             if (shouldHandleMessage) {
                 sw.getListenerReadLock().lock();
                 try {
                     if (sw.isConnected()) {
                         if (!state.hsState.equals(HandshakeState.READY)) {
-                            log.debug("Ignoring message type {} received " + 
-                                      "from switch {} before switch is " + 
-                                      "fully configured.", m.getType(), sw);
+                            log.debug("Ignoring message type {} received " +
+                                    "from switch {} before switch is " +
+                                    "fully configured.", m.getType(), sw);
                         }
                         // Check if the controller is in the slave role for the 
                         // switch. If it is, then don't dispatch the message to 
@@ -1043,8 +1043,7 @@
                             handleMessage(sw, m, null);
                         }
                     }
-                }
-                finally {
+                } finally {
                     sw.getListenerReadLock().unlock();
                 }
             }
@@ -1054,41 +1053,41 @@
     // ****************
     // Message handlers
     // ****************
-    
+
     protected void handlePortStatusMessage(IOFSwitch sw,
                                            OFPortStatus m,
                                            boolean updateStorage) {
         short portNumber = m.getDesc().getPortNumber();
         OFPhysicalPort port = m.getDesc();
-        if (m.getReason() == (byte)OFPortReason.OFPPR_MODIFY.ordinal()) {
-        	boolean portDown = ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
-            		((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
+        if (m.getReason() == (byte) OFPortReason.OFPPR_MODIFY.ordinal()) {
+            boolean portDown = ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
+                    ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
             sw.setPort(port);
-           if (!portDown) {
-               SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTADDED);
-               try {
-                   this.updates.put(update);
-               } catch (InterruptedException e) {
-                   log.error("Failure adding update to queue", e);
-               }
-           } else {
-               SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTREMOVED);
-               try {
-                   this.updates.put(update);
-               } catch (InterruptedException e) {
-                   log.error("Failure adding update to queue", e);
-               }
-           }
+            if (!portDown) {
+                SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTADDED);
+                try {
+                    this.updates.put(update);
+                } catch (InterruptedException e) {
+                    log.error("Failure adding update to queue", e);
+                }
+            } else {
+                SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTREMOVED);
+                try {
+                    this.updates.put(update);
+                } catch (InterruptedException e) {
+                    log.error("Failure adding update to queue", e);
+                }
+            }
             //if (updateStorage)
-                //updatePortInfo(sw, port);
+            //updatePortInfo(sw, port);
             log.debug("Port #{} modified for {}", portNumber, sw);
-        } else if (m.getReason() == (byte)OFPortReason.OFPPR_ADD.ordinal()) {
-        	// XXX Workaround to prevent race condition where a link is detected
-        	// and attempted to be written to the database before the port is in
-        	// the database. We now suppress link discovery on ports until we're
-        	// sure they're in the database.
-        	linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
-        	
+        } else if (m.getReason() == (byte) OFPortReason.OFPPR_ADD.ordinal()) {
+            // XXX Workaround to prevent race condition where a link is detected
+            // and attempted to be written to the database before the port is in
+            // the database. We now suppress link discovery on ports until we're
+            // sure they're in the database.
+            linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
+
             sw.setPort(port);
             SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTADDED);
             try {
@@ -1097,10 +1096,10 @@
                 log.error("Failure adding update to queue", e);
             }
             //if (updateStorage)
-                //updatePortInfo(sw, port);
+            //updatePortInfo(sw, port);
             log.debug("Port #{} added for {}", portNumber, sw);
-        } else if (m.getReason() == 
-                   (byte)OFPortReason.OFPPR_DELETE.ordinal()) {
+        } else if (m.getReason() ==
+                (byte) OFPortReason.OFPPR_DELETE.ordinal()) {
             sw.deletePort(portNumber);
             SwitchUpdate update = new SwitchUpdate(sw, port, SwitchUpdateType.PORTREMOVED);
             try {
@@ -1109,7 +1108,7 @@
                 log.error("Failure adding update to queue", e);
             }
             //if (updateStorage)
-                //removePortInfo(sw, portNumber);
+            //removePortInfo(sw, portNumber);
             log.debug("Port #{} deleted for {}", portNumber, sw);
         }
         SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.PORTCHANGED);
@@ -1119,20 +1118,21 @@
             log.error("Failure adding update to queue", e);
         }
     }
-    
+
     /**
      * flcontext_cache - Keep a thread local stack of contexts
      */
     protected static final ThreadLocal<Stack<FloodlightContext>> flcontext_cache =
-        new ThreadLocal <Stack<FloodlightContext>> () {
-            @Override
-            protected Stack<FloodlightContext> initialValue() {
-                return new Stack<FloodlightContext>();
-            }
-        };
+            new ThreadLocal<Stack<FloodlightContext>>() {
+                @Override
+                protected Stack<FloodlightContext> initialValue() {
+                    return new Stack<FloodlightContext>();
+                }
+            };
 
     /**
      * flcontext_alloc - pop a context off the stack, if required create a new one
+     *
      * @return FloodlightContext
      */
     protected static FloodlightContext flcontext_alloc() {
@@ -1140,8 +1140,7 @@
 
         if (flcontext_cache.get().empty()) {
             flcontext = new FloodlightContext();
-        }
-        else {
+        } else {
             flcontext = flcontext_cache.get().pop();
         }
 
@@ -1150,6 +1149,7 @@
 
     /**
      * flcontext_free - Free the context to the current thread
+     *
      * @param flcontext
      */
     protected void flcontext_free(FloodlightContext flcontext) {
@@ -1159,23 +1159,24 @@
 
     /**
      * Handle replies to certain OFMessages, and pass others off to listeners
-     * @param sw The switch for the message
-     * @param m The message
+     *
+     * @param sw       The switch for the message
+     * @param m        The message
      * @param bContext The floodlight context. If null then floodlight context would
-     * be allocated in this function
+     *                 be allocated in this function
      * @throws IOException
      */
     @LogMessageDocs({
-        @LogMessageDoc(level="ERROR",
-                message="Ignoring PacketIn (Xid = {xid}) because the data" +
-                        " field is empty.",
-                explanation="The switch sent an improperly-formatted PacketIn" +
-                        " message",
-                recommendation=LogMessageDoc.CHECK_SWITCH),
-        @LogMessageDoc(level="WARN",
-                message="Unhandled OF Message: {} from {}",
-                explanation="The switch sent a message not handled by " +
-                        "the controller")
+            @LogMessageDoc(level = "ERROR",
+                    message = "Ignoring PacketIn (Xid = {xid}) because the data" +
+                            " field is empty.",
+                    explanation = "The switch sent an improperly-formatted PacketIn" +
+                            " message",
+                    recommendation = LogMessageDoc.CHECK_SWITCH),
+            @LogMessageDoc(level = "WARN",
+                    message = "Unhandled OF Message: {} from {}",
+                    explanation = "The switch sent a message not handled by " +
+                            "the controller")
     })
     protected void handleMessage(IOFSwitch sw, OFMessage m,
                                  FloodlightContext bContext)
@@ -1184,14 +1185,14 @@
 
         switch (m.getType()) {
             case PACKET_IN:
-                OFPacketIn pi = (OFPacketIn)m;
-                
+                OFPacketIn pi = (OFPacketIn) m;
+
                 if (pi.getPacketData().length <= 0) {
-                    log.error("Ignoring PacketIn (Xid = " + pi.getXid() + 
-                              ") because the data field is empty.");
+                    log.error("Ignoring PacketIn (Xid = " + pi.getXid() +
+                            ") because the data field is empty.");
                     return;
                 }
-                
+
                 if (Controller.ALWAYS_DECODE_ETH) {
                     eth = new Ethernet();
                     eth.deserialize(pi.getPacketData(), 0,
@@ -1200,13 +1201,13 @@
                 // fall through to default case...
 
             default:
-                
+
                 List<IOFMessageListener> listeners = null;
                 if (messageListeners.containsKey(m.getType())) {
                     listeners = messageListeners.get(m.getType()).
                             getOrderedListeners();
                 }
-                        
+
                 FloodlightContext bc = null;
                 if (listeners != null) {
                     // Check if floodlight context is passed from the calling 
@@ -1218,19 +1219,19 @@
                         bc = bContext;
                     }
                     if (eth != null) {
-                        IFloodlightProviderService.bcStore.put(bc, 
-                                IFloodlightProviderService.CONTEXT_PI_PAYLOAD, 
+                        IFloodlightProviderService.bcStore.put(bc,
+                                IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
                                 eth);
                     }
-                    
+
                     // Get the starting time (overall and per-component) of 
                     // the processing chain for this packet if performance
                     // monitoring is turned on
-                    
+
                     Command cmd;
                     for (IOFMessageListener listener : listeners) {
                         if (listener instanceof IOFSwitchFilter) {
-                            if (!((IOFSwitchFilter)listener).isInterested(sw)) {
+                            if (!((IOFSwitchFilter) listener).isInterested(sw)) {
                                 continue;
                             }
                         }
@@ -1238,7 +1239,7 @@
 
                         cmd = listener.receive(sw, m, bc);
 
-                        
+
                         if (Command.STOP.equals(cmd)) {
                             break;
                         }
@@ -1247,24 +1248,25 @@
                 } else {
                     log.warn("Unhandled OF Message: {} from {}", m, sw);
                 }
-                
+
                 if ((bContext == null) && (bc != null)) flcontext_free(bc);
         }
     }
-    
+
     /**
      * Log an OpenFlow error message from a switch
-     * @param sw The switch that sent the error
+     *
+     * @param sw    The switch that sent the error
      * @param error The error message
      */
-    @LogMessageDoc(level="ERROR",
-            message="Error {error type} {error code} from {switch}",
-            explanation="The switch responded with an unexpected error" +
+    @LogMessageDoc(level = "ERROR",
+            message = "Error {error type} {error code} from {switch}",
+            explanation = "The switch responded with an unexpected error" +
                     "to an OpenFlow message from the controller",
-            recommendation="This could indicate improper network operation. " +
+            recommendation = "This could indicate improper network operation. " +
                     "If the problem persists restarting the switch and " +
                     "controller may help."
-            )
+    )
     protected void logError(IOFSwitch sw, OFError error) {
         int etint = 0xffff & error.getErrorType();
         if (etint < 0 || etint >= OFErrorType.values().length) {
@@ -1273,71 +1275,72 @@
         OFErrorType et = OFErrorType.values()[etint];
         switch (et) {
             case OFPET_HELLO_FAILED:
-                OFHelloFailedCode hfc = 
-                    OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, hfc, sw});
+                OFHelloFailedCode hfc =
+                        OFHelloFailedCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, hfc, sw});
                 break;
             case OFPET_BAD_REQUEST:
-                OFBadRequestCode brc = 
-                    OFBadRequestCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, brc, sw});
+                OFBadRequestCode brc =
+                        OFBadRequestCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, brc, sw});
                 break;
             case OFPET_BAD_ACTION:
                 OFBadActionCode bac =
-                    OFBadActionCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, bac, sw});
+                        OFBadActionCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, bac, sw});
                 break;
             case OFPET_FLOW_MOD_FAILED:
                 OFFlowModFailedCode fmfc =
-                    OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, fmfc, sw});
+                        OFFlowModFailedCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, fmfc, sw});
                 break;
             case OFPET_PORT_MOD_FAILED:
                 OFPortModFailedCode pmfc =
-                    OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, pmfc, sw});
+                        OFPortModFailedCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, pmfc, sw});
                 break;
             case OFPET_QUEUE_OP_FAILED:
                 OFQueueOpFailedCode qofc =
-                    OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
-                log.error("Error {} {} from {}", new Object[] {et, qofc, sw});
+                        OFQueueOpFailedCode.values()[0xffff & error.getErrorCode()];
+                log.error("Error {} {} from {}", new Object[]{et, qofc, sw});
                 break;
             default:
                 break;
         }
     }
-    
+
     /**
      * Add a switch to the active switch list and call the switch listeners.
      * This happens either when a switch first connects (and the controller is
      * not in the slave role) or when the role of the controller changes from
      * slave to master.
+     *
      * @param sw the switch that has been added
      */
     // TODO: need to rethink locking and the synchronous switch update.
     //       We can / should also handle duplicate DPIDs in connectedSwitches
-    @LogMessageDoc(level="ERROR",
-            message="New switch added {switch} for already-added switch {switch}",
-            explanation="A switch with the same DPID as another switch " +
+    @LogMessageDoc(level = "ERROR",
+            message = "New switch added {switch} for already-added switch {switch}",
+            explanation = "A switch with the same DPID as another switch " +
                     "connected to the controller.  This can be caused by " +
                     "multiple switches configured with the same DPID, or " +
                     "by a switch reconnected very quickly after " +
                     "disconnecting.",
-            recommendation="If this happens repeatedly, it is likely there " +
+            recommendation = "If this happens repeatedly, it is likely there " +
                     "are switches with duplicate DPIDs on the network.  " +
                     "Reconfigure the appropriate switches.  If it happens " +
                     "very rarely, then it is likely this is a transient " +
                     "network problem that can be ignored."
-            )
+    )
     protected void addSwitch(IOFSwitch sw) {
-    	// XXX Workaround to prevent race condition where a link is detected
-    	// and attempted to be written to the database before the port is in
-    	// the database. We now suppress link discovery on ports until we're
-    	// sure they're in the database.
-    	for (OFPhysicalPort port : sw.getPorts()) {
-    		linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
-    	}
-    	
+        // XXX Workaround to prevent race condition where a link is detected
+        // and attempted to be written to the database before the port is in
+        // the database. We now suppress link discovery on ports until we're
+        // sure they're in the database.
+        for (OFPhysicalPort port : sw.getPorts()) {
+            linkDiscovery.AddToSuppressLLDPs(sw.getId(), port.getPortNumber());
+        }
+
         // TODO: is it safe to modify the HashMap without holding 
         // the old switch's lock?
         OFSwitchImpl oldSw = (OFSwitchImpl) this.activeSwitches.put(sw.getId(), sw);
@@ -1346,20 +1349,20 @@
             log.info("New add switch for pre-existing switch {}", sw);
             return;
         }
-        
+
         if (oldSw != null) {
             oldSw.getListenerWriteLock().lock();
             try {
                 log.error("New switch added {} for already-added switch {}",
-                          sw, oldSw);
+                        sw, oldSw);
                 // Set the connected flag to false to suppress calling
                 // the listeners for this switch in processOFMessage
                 oldSw.setConnected(false);
-                
+
                 oldSw.cancelAllStatisticsReplies();
-                
+
                 //updateInactiveSwitchInfo(oldSw);
-    
+
                 // we need to clean out old switch state definitively 
                 // before adding the new switch
                 // FIXME: It seems not completely kosher to call the
@@ -1378,14 +1381,13 @@
                 // TODO: Figure out a way to handle this that avoids the
                 // spurious debug message.
                 log.debug("Closing {} because a new IOFSwitch got added " +
-                		"for this dpid", oldSw);
+                        "for this dpid", oldSw);
                 oldSw.getChannel().close();
-            }
-            finally {
+            } finally {
                 oldSw.getListenerWriteLock().unlock();
             }
         }
-        
+
         //updateActiveSwitchInfo(sw);
         SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.ADDED);
         try {
@@ -1399,6 +1401,7 @@
      * Remove a switch from the active switch list and call the switch listeners.
      * This happens either when the switch is disconnected or when the
      * controller's role for the switch changes from master to slave.
+     *
      * @param sw the switch that has been removed
      */
     protected void removeSwitch(IOFSwitch sw) {
@@ -1415,7 +1418,7 @@
         // from slave controllers. Then we need to move this cancelation
         // to switch disconnect
         sw.cancelAllStatisticsReplies();
-            
+
         // FIXME: I think there's a race condition if we call updateInactiveSwitchInfo
         // here if role support is enabled. In that case if the switch is being
         // removed because we've been switched to being in the slave role, then I think
@@ -1424,7 +1427,7 @@
         // updateInactiveSwitchInfo we may wipe out all of the state that was
         // written out by the new master. Maybe need to revisit how we handle all
         // of the switch state that's written to storage.
-        
+
         //updateInactiveSwitchInfo(sw);
         SwitchUpdate update = new SwitchUpdate(sw, SwitchUpdateType.REMOVED);
         try {
@@ -1433,16 +1436,16 @@
             log.error("Failure adding update to queue", e);
         }
     }
-    
+
     // ***************
     // IFloodlightProvider
     // ***************
-    
+
     @Override
-    public synchronized void addOFMessageListener(OFType type, 
+    public synchronized void addOFMessageListener(OFType type,
                                                   IOFMessageListener listener) {
-        ListenerDispatcher<OFType, IOFMessageListener> ldd = 
-            messageListeners.get(type);
+        ListenerDispatcher<OFType, IOFMessageListener> ldd =
+                messageListeners.get(type);
         if (ldd == null) {
             ldd = new ListenerDispatcher<OFType, IOFMessageListener>();
             messageListeners.put(type, ldd);
@@ -1453,23 +1456,23 @@
     @Override
     public synchronized void removeOFMessageListener(OFType type,
                                                      IOFMessageListener listener) {
-        ListenerDispatcher<OFType, IOFMessageListener> ldd = 
-            messageListeners.get(type);
+        ListenerDispatcher<OFType, IOFMessageListener> ldd =
+                messageListeners.get(type);
         if (ldd != null) {
             ldd.removeListener(listener);
         }
     }
-    
+
     private void logListeners() {
         for (Map.Entry<OFType,
-                       ListenerDispatcher<OFType, 
-                                          IOFMessageListener>> entry
-             : messageListeners.entrySet()) {
-            
+                ListenerDispatcher<OFType,
+                        IOFMessageListener>> entry
+                : messageListeners.entrySet()) {
+
             OFType type = entry.getKey();
-            ListenerDispatcher<OFType, IOFMessageListener> ldd = 
+            ListenerDispatcher<OFType, IOFMessageListener> ldd =
                     entry.getValue();
-            
+
             StringBuffer sb = new StringBuffer();
             sb.append("OFListeners for ");
             sb.append(type);
@@ -1478,10 +1481,10 @@
                 sb.append(l.getName());
                 sb.append(",");
             }
-            log.debug(sb.toString());            
+            log.debug(sb.toString());
         }
     }
-    
+
     public void removeOFMessageListeners(OFType type) {
         messageListeners.remove(type);
     }
@@ -1503,26 +1506,26 @@
 
     @Override
     public Map<OFType, List<IOFMessageListener>> getListeners() {
-        Map<OFType, List<IOFMessageListener>> lers = 
-            new HashMap<OFType, List<IOFMessageListener>>();
-        for(Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e : 
-            messageListeners.entrySet()) {
+        Map<OFType, List<IOFMessageListener>> lers =
+                new HashMap<OFType, List<IOFMessageListener>>();
+        for (Entry<OFType, ListenerDispatcher<OFType, IOFMessageListener>> e :
+                messageListeners.entrySet()) {
             lers.put(e.getKey(), e.getValue().getOrderedListeners());
         }
         return Collections.unmodifiableMap(lers);
     }
-    
+
     @Override
     @LogMessageDocs({
-        @LogMessageDoc(message="Failed to inject OFMessage {message} onto " +
-                "a null switch",
-                explanation="Failed to process a message because the switch " +
-                " is no longer connected."),
-        @LogMessageDoc(level="ERROR",
-                message="Error reinjecting OFMessage on switch {switch}",
-                explanation="An I/O error occured while attempting to " +
-                        "process an OpenFlow message",
-                recommendation=LogMessageDoc.CHECK_SWITCH)
+            @LogMessageDoc(message = "Failed to inject OFMessage {message} onto " +
+                    "a null switch",
+                    explanation = "Failed to process a message because the switch " +
+                            " is no longer connected."),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Error reinjecting OFMessage on switch {switch}",
+                    explanation = "An I/O error occured while attempting to " +
+                            "process an OpenFlow message",
+                    recommendation = LogMessageDoc.CHECK_SWITCH)
     })
     public boolean injectOfMessage(IOFSwitch sw, OFMessage msg,
                                    FloodlightContext bc) {
@@ -1530,7 +1533,7 @@
             log.info("Failed to inject OFMessage {} onto a null switch", msg);
             return false;
         }
-        
+
         // FIXME: Do we need to be able to inject messages to switches
         // where we're the slave controller (i.e. they're connected but
         // not active)?
@@ -1541,32 +1544,32 @@
         // through the normal netty event processing, including being
         // handled 
         if (!activeSwitches.containsKey(sw.getId())) return false;
-        
+
         try {
             // Pass Floodlight context to the handleMessages()
             handleMessage(sw, msg, bc);
         } catch (IOException e) {
-            log.error("Error reinjecting OFMessage on switch {}", 
-                      HexString.toHexString(sw.getId()));
+            log.error("Error reinjecting OFMessage on switch {}",
+                    HexString.toHexString(sw.getId()));
             return false;
         }
         return true;
     }
 
     @Override
-    @LogMessageDoc(message="Calling System.exit",
-                   explanation="The controller is terminating")
+    @LogMessageDoc(message = "Calling System.exit",
+            explanation = "The controller is terminating")
     public synchronized void terminate() {
         log.info("Calling System.exit");
         System.exit(1);
     }
-    
+
     @Override
     public boolean injectOfMessage(IOFSwitch sw, OFMessage msg) {
         // call the overloaded version with floodlight context set to null    
         return injectOfMessage(sw, msg, null);
     }
-    
+
     @Override
     public void handleOutgoingMessage(IOFSwitch sw, OFMessage m,
                                       FloodlightContext bc) {
@@ -1577,14 +1580,14 @@
 
         List<IOFMessageListener> listeners = null;
         if (messageListeners.containsKey(m.getType())) {
-            listeners = 
+            listeners =
                     messageListeners.get(m.getType()).getOrderedListeners();
         }
-            
-        if (listeners != null) {                
+
+        if (listeners != null) {
             for (IOFMessageListener listener : listeners) {
                 if (listener instanceof IOFSwitchFilter) {
-                    if (!((IOFSwitchFilter)listener).isInterested(sw)) {
+                    if (!((IOFSwitchFilter) listener).isInterested(sw)) {
                         continue;
                     }
                 }
@@ -1599,12 +1602,12 @@
     public BasicFactory getOFMessageFactory() {
         return factory;
     }
-    
+
     @Override
     public String getControllerId() {
         return controllerId;
     }
-    
+
     // **************
     // Initialization
     // **************
@@ -1625,18 +1628,19 @@
      * it updates the current role in the file specified by the "role.path"
      * file. Then if floodlight restarts for some reason it can get the
      * correct current role of the controller from the file.
+     *
      * @param configParams The config params for the FloodlightProvider service
      * @return A valid role if role information is specified in the
-     *         config params, otherwise null
+     * config params, otherwise null
      */
     @LogMessageDocs({
-        @LogMessageDoc(message="Controller role set to {role}",
-                explanation="Setting the initial HA role to "),
-        @LogMessageDoc(level="ERROR",
-                message="Invalid current role value: {role}",
-                explanation="An invalid HA role value was read from the " + 
+            @LogMessageDoc(message = "Controller role set to {role}",
+                    explanation = "Setting the initial HA role to "),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Invalid current role value: {role}",
+                    explanation = "An invalid HA role value was read from the " +
                             "properties file",
-                recommendation=LogMessageDoc.CHECK_CONTROLLER)
+                    recommendation = LogMessageDoc.CHECK_CONTROLLER)
     })
     protected Role getInitialRole(Map<String, String> configParams) {
         Role role = null;
@@ -1648,8 +1652,7 @@
                 try {
                     properties.load(new FileInputStream(rolePath));
                     roleString = properties.getProperty("floodlight.role");
-                }
-                catch (IOException exc) {
+                } catch (IOException exc) {
                     // Don't treat it as an error if the file specified by the
                     // rolepath property doesn't exist. This lets us enable the
                     // HA mechanism by just creating/setting the floodlight.role
@@ -1658,60 +1661,60 @@
                 }
             }
         }
-        
+
         if (roleString != null) {
             // Canonicalize the string to the form used for the enum constants
             roleString = roleString.trim().toUpperCase();
             try {
                 role = Role.valueOf(roleString);
-            }
-            catch (IllegalArgumentException exc) {
+            } catch (IllegalArgumentException exc) {
                 log.error("Invalid current role value: {}", roleString);
             }
         }
-        
+
         log.info("Controller role set to {}", role);
-        
+
         return role;
     }
-    
+
     /**
      * Tell controller that we're ready to accept switches loop
-     * @throws IOException 
+     *
+     * @throws IOException
      */
     @LogMessageDocs({
-        @LogMessageDoc(message="Listening for switch connections on {address}",
-                explanation="The controller is ready and listening for new" +
-                        " switch connections"),
-        @LogMessageDoc(message="Storage exception in controller " + 
-                        "updates loop; terminating process",
-                explanation=ERROR_DATABASE,
-                recommendation=LogMessageDoc.CHECK_CONTROLLER),
-        @LogMessageDoc(level="ERROR",
-                message="Exception in controller updates loop",
-                explanation="Failed to dispatch controller event",
-                recommendation=LogMessageDoc.GENERIC_ACTION)
+            @LogMessageDoc(message = "Listening for switch connections on {address}",
+                    explanation = "The controller is ready and listening for new" +
+                            " switch connections"),
+            @LogMessageDoc(message = "Storage exception in controller " +
+                    "updates loop; terminating process",
+                    explanation = ERROR_DATABASE,
+                    recommendation = LogMessageDoc.CHECK_CONTROLLER),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Exception in controller updates loop",
+                    explanation = "Failed to dispatch controller event",
+                    recommendation = LogMessageDoc.GENERIC_ACTION)
     })
     public void run() {
         if (log.isDebugEnabled()) {
             logListeners();
         }
-        
-        try {            
-           final ServerBootstrap bootstrap = createServerBootStrap();
+
+        try {
+            final ServerBootstrap bootstrap = createServerBootStrap();
 
             bootstrap.setOption("reuseAddr", true);
             bootstrap.setOption("child.keepAlive", true);
             bootstrap.setOption("child.tcpNoDelay", true);
             bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
 
-            ChannelPipelineFactory pfact = 
+            ChannelPipelineFactory pfact =
                     new OpenflowPipelineFactory(this, null);
             bootstrap.setPipelineFactory(pfact);
             InetSocketAddress sa = new InetSocketAddress(openFlowPort);
             final ChannelGroup cg = new DefaultChannelGroup();
             cg.add(bootstrap.bind(sa));
-            
+
             log.info("Listening for switch connections on {}", sa);
         } catch (Exception e) {
             throw new RuntimeException(e);
@@ -1743,7 +1746,7 @@
                             Executors.newCachedThreadPool(), workerThreads));
         }
     }
-    
+
     public void setConfigParams(Map<String, String> configParams) {
         String ofPort = configParams.get("openflowport");
         if (ofPort != null) {
@@ -1758,17 +1761,16 @@
         String controllerId = configParams.get("controllerid");
         if (controllerId != null) {
             this.controllerId = controllerId;
+        } else {
+            //Try to get the hostname of the machine and use that for controller ID
+            try {
+                String hostname = java.net.InetAddress.getLocalHost().getHostName();
+                this.controllerId = hostname;
+            } catch (UnknownHostException e) {
+                // Can't get hostname, we'll just use the default
+            }
         }
-        else {
-        	//Try to get the hostname of the machine and use that for controller ID
-        	try {
-    			String hostname = java.net.InetAddress.getLocalHost().getHostName();
-    			this.controllerId = hostname;
-    		} catch (UnknownHostException e) {
-    			// Can't get hostname, we'll just use the default
-    		}
-        }
-        
+
         log.debug("ControllerId set to {}", this.controllerId);
     }
 
@@ -1787,9 +1789,9 @@
                 new OFBasicVendorDataType(
                         OFRoleReplyVendorData.NXT_ROLE_REPLY,
                         OFRoleReplyVendorData.getInstantiable());
-         niciraVendorId.registerVendorDataType(roleReplyVendorData);
+        niciraVendorId.registerVendorDataType(roleReplyVendorData);
     }
-    
+
     /**
      * Initialize internal data structures
      */
@@ -1797,9 +1799,9 @@
         // These data structures are initialized here because other
         // module's startUp() might be called before ours
         this.messageListeners =
-                new ConcurrentHashMap<OFType, 
-                                      ListenerDispatcher<OFType, 
-                                                         IOFMessageListener>>();
+                new ConcurrentHashMap<OFType,
+                        ListenerDispatcher<OFType,
+                                IOFMessageListener>>();
         this.switchListeners = new CopyOnWriteArraySet<IOFSwitchListener>();
         this.activeSwitches = new ConcurrentHashMap<Long, IOFSwitch>();
         this.connectedSwitches = new HashSet<OFSwitchImpl>();
@@ -1813,33 +1815,33 @@
         initVendorMessages();
         this.systemStartTime = System.currentTimeMillis();
     }
-    
+
     /**
      * Startup all of the controller's components
      */
-    @LogMessageDoc(message="Waiting for storage source",
-                explanation="The system database is not yet ready",
-                recommendation="If this message persists, this indicates " +
-                        "that the system database has failed to start. " +
-                        LogMessageDoc.CHECK_CONTROLLER)
+    @LogMessageDoc(message = "Waiting for storage source",
+            explanation = "The system database is not yet ready",
+            recommendation = "If this message persists, this indicates " +
+                    "that the system database has failed to start. " +
+                    LogMessageDoc.CHECK_CONTROLLER)
     public void startupComponents() {
-    	try {
-			registryService.registerController(controllerId);
-		} catch (RegistryException e) {
-			log.warn("Registry service error: {}", e.getMessage());
-		}
-       
+        try {
+            registryService.registerController(controllerId);
+        } catch (RegistryException e) {
+            log.warn("Registry service error: {}", e.getMessage());
+        }
+
         // Add our REST API
         restApi.addRestletRoutable(new CoreWebRoutable());
     }
-    
+
     @Override
     public Map<String, String> getControllerNodeIPs() {
         // We return a copy of the mapping so we can guarantee that
         // the mapping return is the same as one that will be (or was)
         // dispatched to IHAListeners
-        HashMap<String,String> retval = new HashMap<String,String>();
-        synchronized(controllerNodeIPsCache) {
+        HashMap<String, String> retval = new HashMap<String, String>();
+        synchronized (controllerNodeIPsCache) {
             retval.putAll(controllerNodeIPsCache);
         }
         return retval;
@@ -1854,7 +1856,7 @@
     public void setAlwaysClearFlowsOnSwAdd(boolean value) {
         this.alwaysClearFlowsOnSwAdd = value;
     }
-    
+
     public boolean getAlwaysClearFlowsOnSwAdd() {
         return this.alwaysClearFlowsOnSwAdd;
     }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutException.java b/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutException.java
index 421ec1a..57fa279 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutException.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutException.java
@@ -1,25 +1,26 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
 /**
- * Exception is thrown when the handshake fails to complete 
+ * Exception is thrown when the handshake fails to complete
  * before a specified time
+ *
  * @author readams
  */
 public class HandshakeTimeoutException extends Exception {
diff --git a/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutHandler.java b/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutHandler.java
index 6d3335f..d5950b4 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutHandler.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/HandshakeTimeoutHandler.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -33,17 +33,17 @@
 /**
  * Trigger a timeout if a switch fails to complete handshake soon enough
  */
-public class HandshakeTimeoutHandler 
-    extends SimpleChannelUpstreamHandler
-    implements ExternalResourceReleasable {
-    static final HandshakeTimeoutException EXCEPTION = 
+public class HandshakeTimeoutHandler
+        extends SimpleChannelUpstreamHandler
+        implements ExternalResourceReleasable {
+    static final HandshakeTimeoutException EXCEPTION =
             new HandshakeTimeoutException();
-    
+
     final OFChannelState state;
     final Timer timer;
     final long timeoutNanos;
     volatile Timeout timeout;
-    
+
     public HandshakeTimeoutHandler(OFChannelState state, Timer timer,
                                    long timeoutSeconds) {
         super();
@@ -52,17 +52,17 @@
         this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
 
     }
-    
+
     @Override
     public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
             throws Exception {
         if (timeoutNanos > 0) {
-            timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx), 
-                                       timeoutNanos, TimeUnit.NANOSECONDS);
+            timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx),
+                    timeoutNanos, TimeUnit.NANOSECONDS);
         }
         ctx.sendUpstream(e);
     }
-    
+
     @Override
     public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
             throws Exception {
@@ -76,7 +76,7 @@
     public void releaseExternalResources() {
         timer.stop();
     }
-    
+
     private final class HandshakeTimeoutTask implements TimerTask {
 
         private final ChannelHandlerContext ctx;
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFChannelState.java b/src/main/java/net/floodlightcontroller/core/internal/OFChannelState.java
index ad5a377..8130c0a 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFChannelState.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFChannelState.java
@@ -1,24 +1,25 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
 /**
  * Wrapper class to hold state for the OpenFlow switch connection
+ *
  * @author readams
  */
 class OFChannelState {
@@ -53,7 +54,7 @@
     protected volatile HandshakeState hsState = HandshakeState.START;
     protected boolean hasGetConfigReply = false;
     protected boolean hasDescription = false;
-    
+
     // The firstRoleReplyRecevied flag indicates if we have received the
     // first role reply message on this connection (in response to the 
     // role request sent after the handshake). If role support is disabled
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFFeaturesReplyFuture.java b/src/main/java/net/floodlightcontroller/core/internal/OFFeaturesReplyFuture.java
index eca67bd..70ab58e 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFFeaturesReplyFuture.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFFeaturesReplyFuture.java
@@ -1,6 +1,6 @@
 /**
  *    Copyright 2012, Big Switch Networks, Inc. 
- * 
+ *
  *    Licensed 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
@@ -28,7 +28,7 @@
 /**
  * A concrete implementation that handles asynchronously receiving
  * OFFeaturesReply
- * 
+ *
  * @author Shudong Zhou
  */
 public class OFFeaturesReplyFuture extends
@@ -37,13 +37,13 @@
     protected volatile boolean finished;
 
     public OFFeaturesReplyFuture(IThreadPoolService tp,
-            IOFSwitch sw, int transactionId) {
+                                 IOFSwitch sw, int transactionId) {
         super(tp, sw, OFType.FEATURES_REPLY, transactionId);
         init();
     }
 
     public OFFeaturesReplyFuture(IThreadPoolService tp,
-            IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
+                                 IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
         super(tp, sw, OFType.FEATURES_REPLY, transactionId, timeout, unit);
         init();
     }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFMessageDecoder.java b/src/main/java/net/floodlightcontroller/core/internal/OFMessageDecoder.java
index 295e967..54fafd5 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFMessageDecoder.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFMessageDecoder.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -30,12 +30,13 @@
 /**
  * Decode an openflow message from a Channel, for use in a netty
  * pipeline
+ *
  * @author readams
  */
 public class OFMessageDecoder extends FrameDecoder {
 
     OFMessageFactory factory = new BasicFactory();
-    
+
     @Override
     protected Object decode(ChannelHandlerContext ctx, Channel channel,
                             ChannelBuffer buffer) throws Exception {
@@ -51,7 +52,7 @@
 
     @Override
     protected Object decodeLast(ChannelHandlerContext ctx, Channel channel,
-                            ChannelBuffer buffer) throws Exception {
+                                ChannelBuffer buffer) throws Exception {
         // This is not strictly needed atthis time. It is used to detect
         // connection reset detection from netty (for debug)
         return null;
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFMessageEncoder.java b/src/main/java/net/floodlightcontroller/core/internal/OFMessageEncoder.java
index 6be5f9a..d61f17e 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFMessageEncoder.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFMessageEncoder.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -29,6 +29,7 @@
 /**
  * Encode an openflow message for output into a ChannelBuffer, for use in a
  * netty pipeline
+ *
  * @author readams
  */
 public class OFMessageEncoder extends OneToOneEncoder {
@@ -36,18 +37,19 @@
     @Override
     protected Object encode(ChannelHandlerContext ctx, Channel channel,
                             Object msg) throws Exception {
-        if (!(  msg instanceof List))
+        if (!(msg instanceof List))
             return msg;
 
         @SuppressWarnings("unchecked")
-        List<OFMessage> msglist = (List<OFMessage>)msg;
+        List<OFMessage> msglist = (List<OFMessage>) msg;
         int size = 0;
-        for (OFMessage ofm :  msglist) {
-                size += ofm.getLengthU();
+        for (OFMessage ofm : msglist) {
+            size += ofm.getLengthU();
         }
 
-        ChannelBuffer buf = ChannelBuffers.buffer(size);;
-        for (OFMessage ofm :  msglist) {
+        ChannelBuffer buf = ChannelBuffers.buffer(size);
+        ;
+        for (OFMessage ofm : msglist) {
             ofm.writeTo(buf);
         }
         return buf;
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFMessageFuture.java b/src/main/java/net/floodlightcontroller/core/internal/OFMessageFuture.java
index 60b932f..bd8456f 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFMessageFuture.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFMessageFuture.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -51,13 +51,13 @@
     protected static final TimeUnit DEFAULT_TIMEOUT_UNIT = TimeUnit.SECONDS;
 
     public OFMessageFuture(IThreadPoolService tp,
-            IOFSwitch sw, OFType responseType, int transactionId) {
-        this(tp, sw, responseType, transactionId, 
-                 DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_UNIT);
+                           IOFSwitch sw, OFType responseType, int transactionId) {
+        this(tp, sw, responseType, transactionId,
+                DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_UNIT);
     }
 
     public OFMessageFuture(IThreadPoolService tp,
-            IOFSwitch sw, OFType responseType, int transactionId, long timeout, TimeUnit unit) {
+                           IOFSwitch sw, OFType responseType, int transactionId, long timeout, TimeUnit unit) {
         this.threadPool = tp;
         this.canceled = false;
         this.latch = new CountDownLatch(1);
@@ -80,7 +80,7 @@
         this.timeoutTimer = null;
     }
 
-  
+
     public void deliverFuture(IOFSwitch sw, OFMessage msg) {
         if (transactionId == msg.getXid()) {
             handleReply(sw, msg);
@@ -95,6 +95,7 @@
      * Used to handle the specific expected message this Future was reigstered
      * for, the specified msg parameter is guaranteed to match the type and
      * transaction id specified.
+     *
      * @param sw
      * @param msg
      * @return
@@ -106,6 +107,7 @@
      * indicate when the future can deregister itself from receiving future
      * messages, and when it is safe to return the results to any waiting
      * threads.
+     *
      * @return when this Future has completed its work
      */
     protected abstract boolean isFinished();
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFStatisticsFuture.java b/src/main/java/net/floodlightcontroller/core/internal/OFStatisticsFuture.java
index 4d3f733..4651c74 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFStatisticsFuture.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFStatisticsFuture.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -31,7 +31,7 @@
 
 /**
  * A concrete implementation that handles asynchronously receiving OFStatistics
- * 
+ *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public class OFStatisticsFuture extends
@@ -40,13 +40,13 @@
     protected volatile boolean finished;
 
     public OFStatisticsFuture(IThreadPoolService tp,
-            IOFSwitch sw, int transactionId) {
+                              IOFSwitch sw, int transactionId) {
         super(tp, sw, OFType.STATS_REPLY, transactionId);
         init();
     }
 
     public OFStatisticsFuture(IThreadPoolService tp,
-            IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
+                              IOFSwitch sw, int transactionId, long timeout, TimeUnit unit) {
         super(tp, sw, OFType.STATS_REPLY, transactionId, timeout, unit);
         init();
     }
@@ -71,7 +71,7 @@
     protected boolean isFinished() {
         return finished;
     }
-    
+
     @Override
     protected void unRegister() {
         super.unRegister();
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
index 3164381..96ddc7c 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OFSwitchImpl.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -82,11 +82,11 @@
     // exception that can then be handled by callers?
     protected final static Logger log = LoggerFactory.getLogger(OFSwitchImpl.class);
 
-    private static final String HA_CHECK_SWITCH = 
+    private static final String HA_CHECK_SWITCH =
             "Check the health of the indicated switch.  If the problem " +
-            "persists or occurs repeatedly, it likely indicates a defect " +
-            "in the switch HA implementation.";
-    
+                    "persists or occurs repeatedly, it likely indicates a defect " +
+                    "in the switch HA implementation.";
+
     protected ConcurrentMap<Object, Object> attributes;
     protected IFloodlightProviderService floodlightProvider;
     protected IThreadPoolService threadPool;
@@ -104,9 +104,9 @@
     // XXX: The OF spec doesn't specify if port names need to be unique but
     //      according it's always the case in practice. 
     protected ConcurrentHashMap<String, OFPhysicalPort> portsByName;
-    protected Map<Integer,OFStatisticsFuture> statsFutureMap;
+    protected Map<Integer, OFStatisticsFuture> statsFutureMap;
     protected Map<Integer, IOFMessageListener> iofMsgListenersMap;
-    protected Map<Integer,OFFeaturesReplyFuture> featuresFutureMap;
+    protected Map<Integer, OFFeaturesReplyFuture> featuresFutureMap;
     protected boolean connected;
     protected Role role;
     protected TimedCache<Long> timedCache;
@@ -114,16 +114,16 @@
     protected ConcurrentMap<Short, Long> portBroadcastCacheHitMap;
     /**
      * When sending a role request message, the role request is added
-     * to this queue. If a role reply is received this queue is checked to 
+     * to this queue. If a role reply is received this queue is checked to
      * verify that the reply matches the expected reply. We require in order
-     * delivery of replies. That's why we use a Queue. 
+     * delivery of replies. That's why we use a Queue.
      * The RoleChanger uses a timeout to ensure we receive a timely reply.
-     * 
-     * Need to synchronize on this instance if a request is sent, received, 
-     * checked. 
+     * <p/>
+     * Need to synchronize on this instance if a request is sent, received,
+     * checked.
      */
     protected LinkedList<PendingRoleRequestEntry> pendingRoleRequests;
-    
+
     /* Switch features from initial featuresReply */
     protected int capabilities;
     protected int buffers;
@@ -132,29 +132,30 @@
     protected long datapathId;
 
     public static IOFSwitchFeatures switchFeatures;
-    protected static final ThreadLocal<Map<OFSwitchImpl,List<OFMessage>>> local_msg_buffer =
-            new ThreadLocal<Map<OFSwitchImpl,List<OFMessage>>>() {
-            @Override
-            protected Map<OFSwitchImpl,List<OFMessage>> initialValue() {
-                return new HashMap<OFSwitchImpl,List<OFMessage>>();
-            }
-    };
-    
+    protected static final ThreadLocal<Map<OFSwitchImpl, List<OFMessage>>> local_msg_buffer =
+            new ThreadLocal<Map<OFSwitchImpl, List<OFMessage>>>() {
+                @Override
+                protected Map<OFSwitchImpl, List<OFMessage>> initialValue() {
+                    return new HashMap<OFSwitchImpl, List<OFMessage>>();
+                }
+            };
+
     // for managing our map sizes
-    protected static final int MAX_MACS_PER_SWITCH  = 1000;
-    
+    protected static final int MAX_MACS_PER_SWITCH = 1000;
+
     protected static class PendingRoleRequestEntry {
         protected int xid;
         protected Role role;
         // cookie is used to identify the role "generation". roleChanger uses
         protected long cookie;
+
         public PendingRoleRequestEntry(int xid, Role role, long cookie) {
             this.xid = xid;
             this.role = role;
             this.cookie = cookie;
         }
     }
-    
+
     public OFSwitchImpl() {
         this.stringId = null;
         this.attributes = new ConcurrentHashMap<Object, Object>();
@@ -164,21 +165,21 @@
         this.portsByNumber = new ConcurrentHashMap<Short, OFPhysicalPort>();
         this.portsByName = new ConcurrentHashMap<String, OFPhysicalPort>();
         this.connected = true;
-        this.statsFutureMap = new ConcurrentHashMap<Integer,OFStatisticsFuture>();
-        this.featuresFutureMap = new ConcurrentHashMap<Integer,OFFeaturesReplyFuture>();
-        this.iofMsgListenersMap = new ConcurrentHashMap<Integer,IOFMessageListener>();
+        this.statsFutureMap = new ConcurrentHashMap<Integer, OFStatisticsFuture>();
+        this.featuresFutureMap = new ConcurrentHashMap<Integer, OFFeaturesReplyFuture>();
+        this.iofMsgListenersMap = new ConcurrentHashMap<Integer, IOFMessageListener>();
         this.role = null;
-        this.timedCache = new TimedCache<Long>(100, 5*1000 );  // 5 seconds interval
+        this.timedCache = new TimedCache<Long>(100, 5 * 1000);  // 5 seconds interval
         this.listenerLock = new ReentrantReadWriteLock();
         this.portBroadcastCacheHitMap = new ConcurrentHashMap<Short, Long>();
         this.pendingRoleRequests = new LinkedList<OFSwitchImpl.PendingRoleRequestEntry>();
-        
+
         // Defaults properties for an ideal switch
         this.setAttribute(PROP_FASTWILDCARDS, OFMatch.OFPFW_ALL);
         this.setAttribute(PROP_SUPPORTS_OFPP_FLOOD, new Boolean(true));
         this.setAttribute(PROP_SUPPORTS_OFPP_TABLE, new Boolean(true));
     }
-    
+
 
     @Override
     public Object getAttribute(String name) {
@@ -187,7 +188,7 @@
         }
         return null;
     }
-    
+
     @Override
     public void setAttribute(String name, Object value) {
         this.attributes.put(name, value);
@@ -198,12 +199,12 @@
     public Object removeAttribute(String name) {
         return this.attributes.remove(name);
     }
-    
+
     @Override
     public boolean hasAttribute(String name) {
         return this.attributes.containsKey(name);
     }
-        
+
     @Override
     @JsonIgnore
     public Channel getChannel() {
@@ -214,10 +215,10 @@
     public void setChannel(Channel channel) {
         this.channel = channel;
     }
-    
+
     @Override
     public void write(OFMessage m, FloodlightContext bc) throws IOException {
-        Map<OFSwitchImpl,List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
+        Map<OFSwitchImpl, List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
         List<OFMessage> msg_buffer = msg_buffer_map.get(this);
         if (msg_buffer == null) {
             msg_buffer = new ArrayList<OFMessage>();
@@ -228,20 +229,20 @@
         msg_buffer.add(m);
 
         if ((msg_buffer.size() >= Controller.BATCH_MAX_SIZE) ||
-            ((m.getType() != OFType.PACKET_OUT) && (m.getType() != OFType.FLOW_MOD))) {
+                ((m.getType() != OFType.PACKET_OUT) && (m.getType() != OFType.FLOW_MOD))) {
             this.write(msg_buffer);
             msg_buffer.clear();
         }
     }
 
     @Override
-    @LogMessageDoc(level="WARN",
-                   message="Sending OF message that modifies switch " +
-                           "state while in the slave role: {switch}",
-                   explanation="An application has sent a message to a switch " +
-                   		"that is not valid when the switch is in a slave role",
-                   recommendation=LogMessageDoc.REPORT_CONTROLLER_BUG)
-    public void write(List<OFMessage> msglist, 
+    @LogMessageDoc(level = "WARN",
+            message = "Sending OF message that modifies switch " +
+                    "state while in the slave role: {switch}",
+            explanation = "An application has sent a message to a switch " +
+                    "that is not valid when the switch is in a slave role",
+            recommendation = LogMessageDoc.REPORT_CONTROLLER_BUG)
+    public void write(List<OFMessage> msglist,
                       FloodlightContext bc) throws IOException {
         for (OFMessage m : msglist) {
             if (role == Role.SLAVE) {
@@ -250,8 +251,8 @@
                     case FLOW_MOD:
                     case PORT_MOD:
                         log.warn("Sending OF message that modifies switch " +
-                        		 "state while in the slave role: {}", 
-                        		 m.getType().name());
+                                "state while in the slave role: {}",
+                                m.getType().name());
                         break;
                     default:
                         break;
@@ -265,7 +266,7 @@
     public void write(List<OFMessage> msglist) throws IOException {
         this.channel.write(msglist);
     }
-    
+
     @Override
     public void disconnectOutputStream() {
         channel.close();
@@ -274,7 +275,7 @@
     @Override
     @JsonIgnore
     public void setFeaturesReply(OFFeaturesReply featuresReply) {
-        synchronized(portLock) {
+        synchronized (portLock) {
             if (stringId == null) {
                 /* ports are updated via port status message, so we
                  * only fill in ports on initial connection.
@@ -303,7 +304,7 @@
         }
         return result;
     }
-    
+
     @Override
     @JsonIgnore
     public Collection<Short> getEnabledPortNumbers() {
@@ -320,7 +321,7 @@
     public OFPhysicalPort getPort(short portNumber) {
         return portsByNumber.get(portNumber);
     }
-    
+
     @Override
     public OFPhysicalPort getPort(String portName) {
         return portsByName.get(portName);
@@ -329,29 +330,29 @@
     @Override
     @JsonIgnore
     public void setPort(OFPhysicalPort port) {
-        synchronized(portLock) {
+        synchronized (portLock) {
             portsByNumber.put(port.getPortNumber(), port);
             portsByName.put(port.getName(), port);
         }
     }
-    
+
     @Override
     @JsonProperty("ports")
     public Collection<OFPhysicalPort> getPorts() {
         return Collections.unmodifiableCollection(portsByNumber.values());
     }
-    
+
     @Override
     public void deletePort(short portNumber) {
-        synchronized(portLock) {
+        synchronized (portLock) {
             portsByName.remove(portsByNumber.get(portNumber).getName());
             portsByNumber.remove(portNumber);
         }
     }
-    
+
     @Override
     public void deletePort(String portName) {
-        synchronized(portLock) {
+        synchronized (portLock) {
             portsByNumber.remove(portsByName.get(portName).getPortNumber());
             portsByName.remove(portName);
         }
@@ -362,13 +363,13 @@
         if (portsByNumber.get(portNumber) == null) return false;
         return portEnabled(portsByNumber.get(portNumber));
     }
-    
+
     @Override
     public boolean portEnabled(String portName) {
         if (portsByName.get(portName) == null) return false;
         return portEnabled(portsByName.get(portName));
     }
-    
+
     @Override
     public boolean portEnabled(OFPhysicalPort port) {
         if (port == null)
@@ -382,9 +383,9 @@
         //    return false;
         return true;
     }
-    
+
     @Override
-    @JsonSerialize(using=DPIDSerializer.class)
+    @JsonSerialize(using = DPIDSerializer.class)
     @JsonProperty("dpid")
     public long getId() {
         if (this.stringId == null)
@@ -424,7 +425,7 @@
 
     @Override
     public void sendStatsQuery(OFStatisticsRequest request, int xid,
-                                IOFMessageListener caller) throws IOException {
+                               IOFMessageListener caller) throws IOException {
         request.setXid(xid);
         this.iofMsgListenersMap.put(xid, caller);
         List<OFMessage> msglist = new ArrayList<OFMessage>(1);
@@ -462,7 +463,7 @@
 
     @Override
     public void cancelStatisticsReply(int transactionId) {
-        if (null ==  this.statsFutureMap.remove(transactionId)) {
+        if (null == this.statsFutureMap.remove(transactionId)) {
             this.iofMsgListenersMap.remove(transactionId);
         }
     }
@@ -478,8 +479,8 @@
         statsFutureMap.clear();
         iofMsgListenersMap.clear();
     }
- 
-    
+
+
     /**
      * @param floodlightProvider the floodlightProvider to set
      */
@@ -487,7 +488,7 @@
     public void setFloodlightProvider(IFloodlightProviderService floodlightProvider) {
         this.floodlightProvider = floodlightProvider;
     }
-    
+
     @JsonIgnore
     public void setThreadPoolService(IThreadPoolService tp) {
         this.threadPool = tp;
@@ -504,18 +505,18 @@
     public synchronized void setConnected(boolean connected) {
         this.connected = connected;
     }
-    
+
     @Override
     public Role getRole() {
         return role;
     }
-    
+
     @JsonIgnore
     @Override
     public boolean isActive() {
         return (role != Role.SLAVE);
     }
-    
+
     @Override
     @JsonIgnore
     public void setSwitchProperties(OFDescriptionStatistics description) {
@@ -525,20 +526,20 @@
     }
 
     @Override
-    @LogMessageDoc(level="ERROR",
-                   message="Failed to clear all flows on switch {switch}",
-                   explanation="An I/O error occured while trying to clear " +
-                   		"flows on the switch.",
-                   recommendation=LogMessageDoc.CHECK_SWITCH)
+    @LogMessageDoc(level = "ERROR",
+            message = "Failed to clear all flows on switch {switch}",
+            explanation = "An I/O error occured while trying to clear " +
+                    "flows on the switch.",
+            recommendation = LogMessageDoc.CHECK_SWITCH)
     public void clearAllFlowMods() {
         // Delete all pre-existing flows
         OFMatch match = new OFMatch().setWildcards(OFMatch.OFPFW_ALL);
         OFMessage fm = ((OFFlowMod) floodlightProvider.getOFMessageFactory()
-            .getMessage(OFType.FLOW_MOD))
+                .getMessage(OFType.FLOW_MOD))
                 .setMatch(match)
-            .setCommand(OFFlowMod.OFPFC_DELETE)
-            .setOutPort(OFPort.OFPP_NONE)
-            .setLength(U16.t(OFFlowMod.MINIMUM_LENGTH));
+                .setCommand(OFFlowMod.OFPFC_DELETE)
+                .setOutPort(OFPort.OFPP_NONE)
+                .setLength(U16.t(OFFlowMod.MINIMUM_LENGTH));
         try {
             List<OFMessage> msglist = new ArrayList<OFMessage>(1);
             msglist.add(fm);
@@ -564,13 +565,13 @@
     @Override
     @JsonIgnore
     public Map<Short, Long> getPortBroadcastHits() {
-    	return this.portBroadcastCacheHitMap;
+        return this.portBroadcastCacheHitMap;
     }
-    
+
 
     @Override
     public void flush() {
-        Map<OFSwitchImpl,List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
+        Map<OFSwitchImpl, List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
         List<OFMessage> msglist = msg_buffer_map.get(this);
         if ((msglist != null) && (msglist.size() > 0)) {
             try {
@@ -584,7 +585,7 @@
     }
 
     public static void flush_all() {
-        Map<OFSwitchImpl,List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
+        Map<OFSwitchImpl, List<OFMessage>> msg_buffer_map = local_msg_buffer.get();
         for (OFSwitchImpl sw : msg_buffer_map.keySet()) {
             sw.flush();
         }
@@ -594,7 +595,8 @@
      * Return a read lock that must be held while calling the listeners for
      * messages from the switch. Holding the read lock prevents the active
      * switch list from being modified out from under the listeners.
-     * @return 
+     *
+     * @return
      */
     @JsonIgnore
     public Lock getListenerReadLock() {
@@ -606,6 +608,7 @@
      * list of active switches. This is to ensure that the active switch list
      * doesn't change out from under the listeners as they are handling a
      * message from the switch.
+     *
      * @return
      */
     @JsonIgnore
@@ -615,29 +618,31 @@
 
     /**
      * Get the IP Address for the switch
+     *
      * @return the inet address
      */
-    @JsonSerialize(using=ToStringSerializer.class)
+    @JsonSerialize(using = ToStringSerializer.class)
     public SocketAddress getInetAddress() {
         return channel.getRemoteAddress();
     }
-    
+
     /**
      * Send NX role request message to the switch requesting the specified role.
-     * 
-     * This method should ONLY be called by @see RoleChanger.submitRequest(). 
-     * 
+     * <p/>
+     * This method should ONLY be called by @see RoleChanger.submitRequest().
+     * <p/>
      * After sending the request add it to the queue of pending request. We
      * use the queue to later verify that we indeed receive the correct reply.
-     * @param sw switch to send the role request message to
-     * @param role role to request
+     *
+     * @param sw     switch to send the role request message to
+     * @param role   role to request
      * @param cookie an opaque value that will be stored in the pending queue so
-     *        RoleChanger can check for timeouts.
+     *               RoleChanger can check for timeouts.
      * @return transaction id of the role request message that was sent
      */
     protected int sendNxRoleRequest(Role role, long cookie)
             throws IOException {
-        synchronized(pendingRoleRequests) {
+        synchronized (pendingRoleRequests) {
             // Convert the role enum to the appropriate integer constant used
             // in the NX role request message
             int nxRole = 0;
@@ -653,13 +658,13 @@
                     break;
                 default:
                     log.error("Invalid Role specified for switch {}."
-                              + " Disconnecting.", this);
+                            + " Disconnecting.", this);
                     // TODO: should throw an error
                     return 0;
             }
-            
+
             // Construct the role request message
-            OFVendor roleRequest = (OFVendor)floodlightProvider.
+            OFVendor roleRequest = (OFVendor) floodlightProvider.
                     getOFMessageFactory().getMessage(OFType.VENDOR);
             int xid = this.getNextTransactionId();
             roleRequest.setXid(xid);
@@ -667,79 +672,76 @@
             OFRoleRequestVendorData roleRequestData = new OFRoleRequestVendorData();
             roleRequestData.setRole(nxRole);
             roleRequest.setVendorData(roleRequestData);
-            roleRequest.setLengthU(OFVendor.MINIMUM_LENGTH + 
-                                   roleRequestData.getLength());
-            
+            roleRequest.setLengthU(OFVendor.MINIMUM_LENGTH +
+                    roleRequestData.getLength());
+
             // Send it to the switch
             List<OFMessage> msglist = new ArrayList<OFMessage>(1);
             msglist.add(roleRequest);
             // FIXME: should this use this.write() in order for messages to
             // be processed by handleOutgoingMessage()
             this.channel.write(msglist);
-            
+
             pendingRoleRequests.add(new PendingRoleRequestEntry(xid, role, cookie));
             return xid;
         }
     }
-    
-    /** 
-     * Deliver a RoleReply message to this switch. Checks if the reply 
-     * message matches the expected reply (head of the pending request queue). 
+
+    /**
+     * Deliver a RoleReply message to this switch. Checks if the reply
+     * message matches the expected reply (head of the pending request queue).
      * We require in-order delivery of replies. If there's any deviation from
-     * our expectations we disconnect the switch. 
-     * 
+     * our expectations we disconnect the switch.
+     * <p/>
      * We must not check the received role against the controller's current
      * role because there's no synchronization but that's fine @see RoleChanger
-     * 
+     * <p/>
      * Will be called by the OFChannelHandler's receive loop
-     * 
-     * @param xid Xid of the reply message
+     *
+     * @param xid  Xid of the reply message
      * @param role The Role in the the reply message
      */
     @LogMessageDocs({
-        @LogMessageDoc(level="ERROR",
-                message="Switch {switch}: received unexpected role reply for " +
-                        "Role {role}" + 
-                        " Disconnecting switch",
-                explanation="The switch sent an unexpected HA role reply",
-                recommendation=HA_CHECK_SWITCH),                           
-        @LogMessageDoc(level="ERROR",
-                message="Switch {switch}: expected role reply with " +
-                        "Xid {xid}, got {xid}. Disconnecting switch",
-                explanation="The switch sent an unexpected HA role reply",
-                recommendation=HA_CHECK_SWITCH),                           
-        @LogMessageDoc(level="ERROR",
-                message="Switch {switch}: expected role reply with " +
-                        "Role {role}, got {role}. Disconnecting switch",
-                explanation="The switch sent an unexpected HA role reply",
-                recommendation=HA_CHECK_SWITCH)                           
+            @LogMessageDoc(level = "ERROR",
+                    message = "Switch {switch}: received unexpected role reply for " +
+                            "Role {role}" +
+                            " Disconnecting switch",
+                    explanation = "The switch sent an unexpected HA role reply",
+                    recommendation = HA_CHECK_SWITCH),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Switch {switch}: expected role reply with " +
+                            "Xid {xid}, got {xid}. Disconnecting switch",
+                    explanation = "The switch sent an unexpected HA role reply",
+                    recommendation = HA_CHECK_SWITCH),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Switch {switch}: expected role reply with " +
+                            "Role {role}, got {role}. Disconnecting switch",
+                    explanation = "The switch sent an unexpected HA role reply",
+                    recommendation = HA_CHECK_SWITCH)
     })
     protected void deliverRoleReply(int xid, Role role) {
-        synchronized(pendingRoleRequests) {
+        synchronized (pendingRoleRequests) {
             PendingRoleRequestEntry head = pendingRoleRequests.poll();
             if (head == null) {
                 // Maybe don't disconnect if the role reply we received is 
                 // for the same role we are already in. 
-                log.error("Switch {}: received unexpected role reply for Role {}" + 
-                          " Disconnecting switch", this, role );
+                log.error("Switch {}: received unexpected role reply for Role {}" +
+                        " Disconnecting switch", this, role);
                 this.channel.close();
-            }
-            else if (head.xid != xid) {
+            } else if (head.xid != xid) {
                 // check xid before role!!
                 log.error("Switch {}: expected role reply with " +
-                       "Xid {}, got {}. Disconnecting switch",
-                       new Object[] { this, head.xid, xid } );
+                        "Xid {}, got {}. Disconnecting switch",
+                        new Object[]{this, head.xid, xid});
                 this.channel.close();
-            }
-            else if (head.role != role) {
+            } else if (head.role != role) {
                 log.error("Switch {}: expected role reply with " +
-                       "Role {}, got {}. Disconnecting switch",
-                       new Object[] { this, head.role, role } );
+                        "Role {}, got {}. Disconnecting switch",
+                        new Object[]{this, head.role, role});
                 this.channel.close();
-            }
-            else {
+            } else {
                 log.debug("Received role reply message from {}, setting role to {}",
-                          this, role);
+                        this, role);
                 if (this.role == null && getAttribute(SWITCH_SUPPORTS_NX_ROLE) == null) {
                     // The first role reply we received. Set the attribute
                     // that the switch supports roles
@@ -749,44 +751,47 @@
             }
         }
     }
-    
-    /** 
+
+    /**
      * Checks whether the given xid matches the xid of the first pending
-     * role request. 
+     * role request.
+     *
      * @param xid
-     * @return 
+     * @return
      */
-    protected boolean checkFirstPendingRoleRequestXid (int xid) {
-        synchronized(pendingRoleRequests) {
+    protected boolean checkFirstPendingRoleRequestXid(int xid) {
+        synchronized (pendingRoleRequests) {
             PendingRoleRequestEntry head = pendingRoleRequests.peek();
             if (head == null)
                 return false;
-            else 
+            else
                 return head.xid == xid;
         }
     }
-    
+
     /**
-     * Checks whether the given request cookie matches the cookie of the first 
+     * Checks whether the given request cookie matches the cookie of the first
      * pending request
+     *
      * @param cookie
      * @return
      */
     protected boolean checkFirstPendingRoleRequestCookie(long cookie) {
-        synchronized(pendingRoleRequests) {
+        synchronized (pendingRoleRequests) {
             PendingRoleRequestEntry head = pendingRoleRequests.peek();
             if (head == null)
                 return false;
-            else 
+            else
                 return head.cookie == cookie;
         }
     }
-    
+
     /**
      * Called if we receive a vendor error message indicating that roles
      * are not supported by the switch. If the xid matches the first pending
      * one, we'll mark the switch as not supporting roles and remove the head.
      * Otherwise we ignore it.
+     *
      * @param xid
      */
     protected void deliverRoleRequestNotSupported(int xid) {
@@ -796,21 +801,21 @@
     /**
      * ONOS Extension to deliverRoleRequestNotSupported().
      * This version return the Roll request made.
-     * @see deliverRoleRequestNotSupported
+     *
      * @param xid
      * @return Role of attempted RoleRequest.
+     * @see deliverRoleRequestNotSupported
      */
     protected Role deliverRoleRequestNotSupportedEx(int xid) {
-        synchronized(pendingRoleRequests) {
+        synchronized (pendingRoleRequests) {
             PendingRoleRequestEntry head = pendingRoleRequests.poll();
             this.role = null;
-            if (head!=null && head.xid == xid) {
+            if (head != null && head.xid == xid) {
                 setAttribute(SWITCH_SUPPORTS_NX_ROLE, false);
                 return head.role;
-            }
-            else {
-            	log.debug("Closing {} because a role request error didn't match " + 
-            			"head of pendingRoleRequests queue", this);
+            } else {
+                log.debug("Closing {} because a role request error didn't match " +
+                        "head of pendingRoleRequests queue", this);
                 this.channel.close();
                 return null;
             }
@@ -873,9 +878,9 @@
     }
 
 
-	@Override
-	public void setupRemoteSwitch(Long dpid) {
-	    this.datapathId = dpid;
-	    this.stringId = HexString.toHexString(this.datapathId);
-	}
+    @Override
+    public void setupRemoteSwitch(Long dpid) {
+        this.datapathId = dpid;
+        this.stringId = HexString.toHexString(this.datapathId);
+    }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
index 4485709..e87989d 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/OpenflowPipelineFactory.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
@@ -30,6 +30,7 @@
 
 /**
  * Creates a ChannelPipeline for a server-side openflow channel
+ *
  * @author readams
  */
 public class OpenflowPipelineFactory implements ChannelPipelineFactory {
@@ -39,7 +40,7 @@
     protected Timer timer;
     protected IdleStateHandler idleHandler;
     protected ReadTimeoutHandler readTimeoutHandler;
-    
+
     public OpenflowPipelineFactory(Controller controller,
                                    ThreadPoolExecutor pipelineExecutor) {
         super();
@@ -49,21 +50,21 @@
         this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
         this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
     }
- 
+
     @Override
     public ChannelPipeline getPipeline() throws Exception {
         OFChannelState state = new OFChannelState();
-        
+
         ChannelPipeline pipeline = Channels.pipeline();
         pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
         pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
         pipeline.addLast("idle", idleHandler);
         pipeline.addLast("timeout", readTimeoutHandler);
         pipeline.addLast("handshaketimeout",
-                         new HandshakeTimeoutHandler(state, timer, 60)); // ONOS: was 15 increased it to fix Issue #296
+                new HandshakeTimeoutHandler(state, timer, 60)); // ONOS: was 15 increased it to fix Issue #296
         if (pipelineExecutor != null)
             pipeline.addLast("pipelineExecutor",
-                             new ExecutionHandler(pipelineExecutor));
+                    new ExecutionHandler(pipelineExecutor));
         pipeline.addLast("handler", controller.getChannelHandler(state));
         return pipeline;
     }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
index 4a21cad..6f1a350 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/RoleChanger.java
@@ -15,93 +15,92 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/** 
+/**
  * This class handles sending of RoleRequest messages to all connected switches.
- * 
+ * <p/>
  * Handling Role Requests is tricky. Roles are hard state on the switch and
  * we can't query it so we need to make sure that we have consistent states
- * on the switches. Whenever we send a role request to the set of connected 
- * switches we need to make sure that we've sent the request to all of them 
- * before we process the next change request. If a new switch connects, we 
+ * on the switches. Whenever we send a role request to the set of connected
+ * switches we need to make sure that we've sent the request to all of them
+ * before we process the next change request. If a new switch connects, we
  * need to send it the current role and need to make sure that the current
  * role doesn't change while we are doing it. We achieve this by synchronizing
  * all these actions on Controller.roleChanger
- * On the receive side: we need to make sure that we receive a reply for each 
- * request we send and that the reply is consistent with the request we sent. 
+ * On the receive side: we need to make sure that we receive a reply for each
+ * request we send and that the reply is consistent with the request we sent.
  * We'd also like to send the role request to the switch asynchronously in a
  * separate thread so we don't block the REST API or other callers.
- * 
+ * <p/>
  * There are potential ways to relax these synchronization requirements:
  * - "Generation ID" for each role request. However, this would be most useful
- *   if it were global for the whole cluster
+ * if it were global for the whole cluster
  * - Regularly resend the controller's current role. Don't know whether this
- *   might have adverse effects on the switch. 
- *   
+ * might have adverse effects on the switch.
+ * <p/>
  * Caveats:
- * - No way to know if another controller (not in our controller cluster) 
- *   sends MASTER requests to connected switches. Then we would drop to
- *   slave role without knowing it. Could regularly resend the current role. 
- *   Ideally the switch would notify us if it demoted us. What happens if
- *   the other controller also regularly resends the same role request? 
- *   Or if the health check determines that
- *   a controller is dead but the controller is still talking to switches (maybe
- *   just its health check failed) and resending the master role request.... 
- *   We could try to detect if a switch demoted us to slave even if we think
- *   we are master (error messages on packet outs, e.g., when sending LLDPs)
- * 
- *
+ * - No way to know if another controller (not in our controller cluster)
+ * sends MASTER requests to connected switches. Then we would drop to
+ * slave role without knowing it. Could regularly resend the current role.
+ * Ideally the switch would notify us if it demoted us. What happens if
+ * the other controller also regularly resends the same role request?
+ * Or if the health check determines that
+ * a controller is dead but the controller is still talking to switches (maybe
+ * just its health check failed) and resending the master role request....
+ * We could try to detect if a switch demoted us to slave even if we think
+ * we are master (error messages on packet outs, e.g., when sending LLDPs)
+ * <p/>
+ * <p/>
  * The general model of Role Request handling is as follows:
- * 
- * - All role request messages are handled by this class. Class Controller 
- *   submits a role change request and the request gets queued. submitRequest
- *   takes a Collection of switches to which to send the request. We make a copy
- *   of this list. 
- * - A thread takes these change requests from the queue and sends them to 
- *   all the switches (using our copy of the switch list). 
+ * <p/>
+ * - All role request messages are handled by this class. Class Controller
+ * submits a role change request and the request gets queued. submitRequest
+ * takes a Collection of switches to which to send the request. We make a copy
+ * of this list.
+ * - A thread takes these change requests from the queue and sends them to
+ * all the switches (using our copy of the switch list).
  * - The OFSwitchImpl sends the request over the wire and puts the request
- *   into a queue of pending request (storing xid and role). We start a timeout 
- *   to make sure we eventually receive a reply from the switch. We use a single
- *   timeout for each request submitted using submitRequest()
+ * into a queue of pending request (storing xid and role). We start a timeout
+ * to make sure we eventually receive a reply from the switch. We use a single
+ * timeout for each request submitted using submitRequest()
  * - After the timeout triggers we go over the list of switches again and
- *   check that a response has been received (by checking the head of the 
- *   OFSwitchImpl's queue of pending requests)
+ * check that a response has been received (by checking the head of the
+ * OFSwitchImpl's queue of pending requests)
  * - We handle requests and timeouts in the same thread. We use a priority queue
- *   to schedule them so we are guaranteed that they are processed in 
- *   the same order as they are submitted. If a request times out we drop
- *   the connection to this switch. 
+ * to schedule them so we are guaranteed that they are processed in
+ * the same order as they are submitted. If a request times out we drop
+ * the connection to this switch.
  * - Since we decouple submission of role change requests and actually sending
- *   them we cannot check a received role reply against the controller's current 
- *   role because the controller's current role could have changed again. 
+ * them we cannot check a received role reply against the controller's current
+ * role because the controller's current role could have changed again.
  * - Receiving Role Reply messages is handled by OFChannelHandler and
- *   OFSwitchImpl directly. The OFSwitchImpl checks if the received request 
- *   is as expected (xid and role match the head of the pending queue in 
- *   OFSwitchImpl). If so
- *   the switch updates its role. Otherwise the connection is dropped. If this
- *   is the first reply, the SWITCH_SUPPORTS_NX_ROLE attribute is set.
- *   Next, we call addSwitch(), removeSwitch() to update the list of active
- *   switches if appropriate.
- * - If we receive an Error indicating that roles are not supported by the 
- *   switch, we set the SWITCH_SUPPORTS_NX_ROLE to false. We keep the 
- *   switch connection alive while in MASTER and EQUAL role. 
- *   (TODO: is this the right behavior for EQUAL??). If the role changes to
- *   SLAVE the switch connection is dropped (remember: only if the switch
- *   doesn't support role requests)  
- *   The expected behavior is that the switch will probably try to reconnect
- *   repeatedly (with some sort of exponential backoff), but after a  while 
- *   will give-up and move on to the next controller-IP configured on the 
- *   switch. This is the serial failover mechanism from OpenFlow spec v1.0.
- *   
+ * OFSwitchImpl directly. The OFSwitchImpl checks if the received request
+ * is as expected (xid and role match the head of the pending queue in
+ * OFSwitchImpl). If so
+ * the switch updates its role. Otherwise the connection is dropped. If this
+ * is the first reply, the SWITCH_SUPPORTS_NX_ROLE attribute is set.
+ * Next, we call addSwitch(), removeSwitch() to update the list of active
+ * switches if appropriate.
+ * - If we receive an Error indicating that roles are not supported by the
+ * switch, we set the SWITCH_SUPPORTS_NX_ROLE to false. We keep the
+ * switch connection alive while in MASTER and EQUAL role.
+ * (TODO: is this the right behavior for EQUAL??). If the role changes to
+ * SLAVE the switch connection is dropped (remember: only if the switch
+ * doesn't support role requests)
+ * The expected behavior is that the switch will probably try to reconnect
+ * repeatedly (with some sort of exponential backoff), but after a  while
+ * will give-up and move on to the next controller-IP configured on the
+ * switch. This is the serial failover mechanism from OpenFlow spec v1.0.
+ * <p/>
  * New switch connection:
  * - Switch handshake is done without sending any role request messages.
  * - After handshake completes, switch is added to the list of connected switches
- *   and we send the first role request message if role
- *   requests are enabled. If roles are disabled automatically promote switch to
- *   active switch list and clear FlowTable.
+ * and we send the first role request message if role
+ * requests are enabled. If roles are disabled automatically promote switch to
+ * active switch list and clear FlowTable.
  * - When we receive the first reply we proceed as above. In addition, if
- *   the role request is for MASTER we wipe the flow table. We do not wipe
- *   the flow table if the switch connected while role supported was disabled
- *   on the controller. 
- *
+ * the role request is for MASTER we wipe the flow table. We do not wipe
+ * the flow table if the switch connected while role supported was disabled
+ * on the controller.
  */
 public class RoleChanger {
     // FIXME: Upon closer inspection DelayQueue seems to be somewhat broken. 
@@ -119,49 +118,58 @@
     protected long lastSubmitTime;
     protected Thread workerThread;
     protected long timeout;
-    protected static long DEFAULT_TIMEOUT = 15L*1000*1000*1000L; // 15s
+    protected static long DEFAULT_TIMEOUT = 15L * 1000 * 1000 * 1000L; // 15s
     protected final static Logger log = LoggerFactory.getLogger(RoleChanger.class);
-    /** 
-     * A queued task to be handled by the Role changer thread. 
+
+    /**
+     * A queued task to be handled by the Role changer thread.
      */
     protected static class RoleChangeTask implements Delayed {
-        protected enum Type { 
-            /** This is a request. Dispatch the role update to switches */
+        protected enum Type {
+            /**
+             * This is a request. Dispatch the role update to switches
+             */
             REQUEST,
-            /** This is a timeout task. Check if all switches have 
-                correctly replied to the previously dispatched role request */
+            /**
+             * This is a timeout task. Check if all switches have
+             * correctly replied to the previously dispatched role request
+             */
             TIMEOUT
         }
+
         // The set of switches to work on
         public Collection<OFSwitchImpl> switches;
         public Role role;
         public Type type;
         // the time when the task should run as nanoTime() 
         public long deadline;
+
         public RoleChangeTask(Collection<OFSwitchImpl> switches, Role role, long deadline) {
             this.switches = switches;
             this.role = role;
             this.type = Type.REQUEST;
             this.deadline = deadline;
         }
+
         @Override
         public int compareTo(Delayed o) {
             Long timeRemaining = getDelay(TimeUnit.NANOSECONDS);
             return timeRemaining.compareTo(o.getDelay(TimeUnit.NANOSECONDS));
         }
+
         @Override
         public long getDelay(TimeUnit tu) {
             long timeRemaining = deadline - System.nanoTime();
             return tu.convert(timeRemaining, TimeUnit.NANOSECONDS);
         }
     }
-    
-    @LogMessageDoc(level="ERROR",
-                   message="RoleRequestWorker task had an uncaught exception.",
-                   explanation="An unknown occured while processing an HA " +
-                   		"role change event.",
-                   recommendation=LogMessageDoc.GENERIC_ACTION)                              
-    protected class RoleRequestWorker extends Thread  {
+
+    @LogMessageDoc(level = "ERROR",
+            message = "RoleRequestWorker task had an uncaught exception.",
+            explanation = "An unknown occured while processing an HA " +
+                    "role change event.",
+            recommendation = LogMessageDoc.GENERIC_ACTION)
+    protected class RoleRequestWorker extends Thread {
         @Override
         public void run() {
             RoleChangeTask t;
@@ -182,61 +190,59 @@
                         t.type = RoleChangeTask.Type.TIMEOUT;
                         t.deadline += timeout;
                         pendingTasks.put(t);
-                    }
-                    else {
+                    } else {
                         verifyRoleReplyReceived(t.switches, t.deadline);
                     }
                 }
-            }
-            catch (Exception e) {
+            } catch (Exception e) {
                 // Should never get here
-                log.error("RoleRequestWorker task had an uncaught exception. ", 
-                          e);
-            }
-            finally {
+                log.error("RoleRequestWorker task had an uncaught exception. ",
+                        e);
+            } finally {
                 // Be nice in case we earlier caught InterruptedExecution
                 if (interrupted)
                     Thread.currentThread().interrupt();
             }
         } // end loop
     }
-    
+
     public RoleChanger() {
         this.pendingTasks = new DelayQueue<RoleChangeTask>();
         this.workerThread = new Thread(new RoleRequestWorker());
         this.timeout = DEFAULT_TIMEOUT;
         this.workerThread.start();
     }
-    
-    
+
+
     public synchronized void submitRequest(Collection<OFSwitchImpl> switches, Role role) {
         long deadline = System.nanoTime();
         // Grrr. stupid DelayQueue. Make sre we have at least 10ms between 
         // role request messages.
-        if (deadline - lastSubmitTime < 10 * 1000*1000) 
-            deadline = lastSubmitTime + 10 * 1000*1000;
+        if (deadline - lastSubmitTime < 10 * 1000 * 1000)
+            deadline = lastSubmitTime + 10 * 1000 * 1000;
         // make a copy of the list 
         ArrayList<OFSwitchImpl> switches_copy = new ArrayList<OFSwitchImpl>(switches);
         RoleChangeTask req = new RoleChangeTask(switches_copy, role, deadline);
         pendingTasks.put(req);
         lastSubmitTime = deadline;
     }
-    
+
     /**
-     * Send a role request message to switches. This checks the capabilities 
-     * of the switch for understanding role request messaging. Currently we only 
-     * support the OVS-style role request message, but once the controller 
-     * supports OF 1.2, this function will also handle sending out the 
+     * Send a role request message to switches. This checks the capabilities
+     * of the switch for understanding role request messaging. Currently we only
+     * support the OVS-style role request message, but once the controller
+     * supports OF 1.2, this function will also handle sending out the
      * OF 1.2-style role request message.
-    * @param switches the collection of switches to send the request too
-     * @param role the role to request
+     *
+     * @param switches the collection of switches to send the request too
+     * @param role     the role to request
      */
-    @LogMessageDoc(level="WARN",
-            message="Failed to send role request message " + 
+    @LogMessageDoc(level = "WARN",
+            message = "Failed to send role request message " +
                     "to switch {switch}: {message}. Disconnecting",
-            explanation="An I/O error occurred while attempting to change " +
-            		"the switch HA role.",
-            recommendation=LogMessageDoc.CHECK_SWITCH)                              
+            explanation = "An I/O error occurred while attempting to change " +
+                    "the switch HA role.",
+            recommendation = LogMessageDoc.CHECK_SWITCH)
     protected void sendRoleRequest(Collection<OFSwitchImpl> switches,
                                    Role role, long cookie) {
         // There are three cases to consider:
@@ -268,33 +274,33 @@
         //    things are configured correctly) it will walk down its list of
         //    controllers and connect to the current master controller.
         Iterator<OFSwitchImpl> iter = switches.iterator();
-        while(iter.hasNext()) {
+        while (iter.hasNext()) {
             OFSwitchImpl sw = iter.next();
             try {
                 Boolean supportsNxRole = (Boolean)
                         sw.getAttribute(IOFSwitch.SWITCH_SUPPORTS_NX_ROLE);
                 if ((supportsNxRole == null) || supportsNxRole) {
                     // Handle cases #1 and #2
-                	log.debug("Sending NxRoleRequest to {}", sw);
+                    log.debug("Sending NxRoleRequest to {}", sw);
                     sw.sendNxRoleRequest(role, cookie);
                 } else {
-                	if (role == Role.MASTER) {
-                		// ONOS extension:
-                		log.debug("Switch {} doesn't support NxRoleRequests, but sending " + 
-                					"{} request anyway", sw, role);
-                		//Send the role request anyway, even though we know the switch
-                		//doesn't support it. The switch will give an error and in our
-                		//error handling code we will add the switch.
-                		//NOTE we *could* just add the switch right away rather than
-                		//going through the overhead of sending a role request - however
-                		//we then have to deal with concurrency issues resulting from
-                		//calling addSwitch outside of a netty handler.
-                		sw.sendNxRoleRequest(role, cookie);
-                	}
-                	// Handle case #3
-                	else if (role == Role.SLAVE) {
+                    if (role == Role.MASTER) {
+                        // ONOS extension:
+                        log.debug("Switch {} doesn't support NxRoleRequests, but sending " +
+                                "{} request anyway", sw, role);
+                        //Send the role request anyway, even though we know the switch
+                        //doesn't support it. The switch will give an error and in our
+                        //error handling code we will add the switch.
+                        //NOTE we *could* just add the switch right away rather than
+                        //going through the overhead of sending a role request - however
+                        //we then have to deal with concurrency issues resulting from
+                        //calling addSwitch outside of a netty handler.
+                        sw.sendNxRoleRequest(role, cookie);
+                    }
+                    // Handle case #3
+                    else if (role == Role.SLAVE) {
                         log.debug("Disconnecting switch {} that doesn't support " +
-                        "role request messages from a controller that went to SLAVE mode");
+                                "role request messages from a controller that went to SLAVE mode");
                         // Closing the channel should result in a call to
                         // channelDisconnect which updates all state 
                         sw.getChannel().close();
@@ -302,33 +308,34 @@
                     }
                 }
             } catch (IOException e) {
-                log.warn("Failed to send role request message " + 
-                         "to switch {}: {}. Disconnecting",
-                         sw, e);
+                log.warn("Failed to send role request message " +
+                        "to switch {}: {}. Disconnecting",
+                        sw, e);
                 sw.getChannel().close();
                 iter.remove();
             }
         }
     }
-    
+
     /**
      * Verify that switches have received a role reply message we sent earlier
+     *
      * @param switches the collection of switches to send the request too
-     * @param cookie the cookie of the request
+     * @param cookie   the cookie of the request
      */
-    @LogMessageDoc(level="WARN",
-            message="Timeout while waiting for role reply from switch {switch}."
+    @LogMessageDoc(level = "WARN",
+            message = "Timeout while waiting for role reply from switch {switch}."
                     + " Disconnecting",
-            explanation="Timed out waiting for the switch to respond to " +
-            		"a request to change the HA role.",
-            recommendation=LogMessageDoc.CHECK_SWITCH)                              
+            explanation = "Timed out waiting for the switch to respond to " +
+                    "a request to change the HA role.",
+            recommendation = LogMessageDoc.CHECK_SWITCH)
     protected void verifyRoleReplyReceived(Collection<OFSwitchImpl> switches,
-                                   long cookie) {
-        for (OFSwitchImpl sw: switches) {
+                                           long cookie) {
+        for (OFSwitchImpl sw : switches) {
             if (sw.checkFirstPendingRoleRequestCookie(cookie)) {
                 sw.getChannel().close();
                 log.warn("Timeout while waiting for role reply from switch {}."
-                         + " Disconnecting", sw);
+                        + " Disconnecting", sw);
             }
         }
     }
diff --git a/src/main/java/net/floodlightcontroller/core/internal/SwitchStateException.java b/src/main/java/net/floodlightcontroller/core/internal/SwitchStateException.java
index d2a928e..8e49799 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/SwitchStateException.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/SwitchStateException.java
@@ -1,24 +1,24 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.internal;
 
 /**
- * 
+ *
  */
 public class SwitchStateException extends Exception {
 
diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java
index 0cbae32..5b311a1 100644
--- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java
+++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleContext.java
@@ -6,99 +6,103 @@
 
 /**
  * The service registry for an IFloodlightProvider.
+ *
  * @author alexreimers
  */
 public class FloodlightModuleContext implements IFloodlightModuleContext {
-	protected Map<Class<? extends IFloodlightService>, IFloodlightService> serviceMap;
-	protected Map<Class<? extends IFloodlightModule>, Map<String, String>> configParams;
-	protected Collection<IFloodlightModule> moduleSet;
-	
-	/**
-	 * Creates the ModuleContext for use with this IFloodlightProvider.
-	 * This will be used as a module registry for all IFloodlightModule(s).
-	 */
-	public FloodlightModuleContext() {
-		serviceMap = 
-		        new HashMap<Class<? extends IFloodlightService>,
-		                              IFloodlightService>();
-		configParams =
-		        new HashMap<Class<? extends IFloodlightModule>,
-		                        Map<String, String>>();
-	}
-	
-	/**
-	 * Adds a IFloodlightModule for this Context.
-	 * @param clazz the service class
-	 * @param service The IFloodlightService to add to the registry
-	 */
-	public void addService(Class<? extends IFloodlightService> clazz, 
-	                       IFloodlightService service) {
-		serviceMap.put(clazz, service);
-	}
-	
-	@SuppressWarnings("unchecked")
+    protected Map<Class<? extends IFloodlightService>, IFloodlightService> serviceMap;
+    protected Map<Class<? extends IFloodlightModule>, Map<String, String>> configParams;
+    protected Collection<IFloodlightModule> moduleSet;
+
+    /**
+     * Creates the ModuleContext for use with this IFloodlightProvider.
+     * This will be used as a module registry for all IFloodlightModule(s).
+     */
+    public FloodlightModuleContext() {
+        serviceMap =
+                new HashMap<Class<? extends IFloodlightService>,
+                        IFloodlightService>();
+        configParams =
+                new HashMap<Class<? extends IFloodlightModule>,
+                        Map<String, String>>();
+    }
+
+    /**
+     * Adds a IFloodlightModule for this Context.
+     *
+     * @param clazz   the service class
+     * @param service The IFloodlightService to add to the registry
+     */
+    public void addService(Class<? extends IFloodlightService> clazz,
+                           IFloodlightService service) {
+        serviceMap.put(clazz, service);
+    }
+
+    @SuppressWarnings("unchecked")
     @Override
-	public <T extends IFloodlightService> T getServiceImpl(Class<T> service) {
-	    IFloodlightService s = serviceMap.get(service);
-		return (T)s;
-	}
-	
-	@Override
-	public Collection<Class<? extends IFloodlightService>> getAllServices() {
-	    return serviceMap.keySet();
-	}
-	
-	@Override
-	public Collection<IFloodlightModule> getAllModules() {
-	    return moduleSet;
-	}
-	
-	public void setModuleSet(Collection<IFloodlightModule> modSet) {
-	    this.moduleSet = modSet;
-	}
-	
-	/**
-	 * Gets the configuration parameter map for a module
-	 * @param module The module to get the configuration map for, usually yourself
-	 * @return A map containing all the configuration parameters for the module, may be empty
-	 */
-	@Override
-	public Map<String, String> getConfigParams(IFloodlightModule module) {
-	    Map<String, String> retMap = configParams.get(module.getClass());
-	    if (retMap == null) {
-	        // Return an empty map if none exists so the module does not
-	        // need to null check the map
-	        retMap = new HashMap<String, String>();
-	        configParams.put(module.getClass(), retMap);
-	    }
+    public <T extends IFloodlightService> T getServiceImpl(Class<T> service) {
+        IFloodlightService s = serviceMap.get(service);
+        return (T) s;
+    }
 
-	    // also add any configuration parameters for superclasses, but
-	    // only if more specific configuration does not override it
-	    for (Class<? extends IFloodlightModule> c : configParams.keySet()) {
-	        if (c.isInstance(module)) {
-	            for (Map.Entry<String, String> ent : configParams.get(c).entrySet()) {
-	                if (!retMap.containsKey(ent.getKey())) {
-	                    retMap.put(ent.getKey(), ent.getValue());
-	                }
-	            }
-	        }
-	    }
+    @Override
+    public Collection<Class<? extends IFloodlightService>> getAllServices() {
+        return serviceMap.keySet();
+    }
 
-	    return retMap;
-	}
-	
-	/**
-	 * Adds a configuration parameter for a module
-	 * @param mod The fully qualified module name to add the parameter to
-	 * @param key The configuration parameter key
-	 * @param value The configuration parameter value
-	 */
-	public void addConfigParam(IFloodlightModule mod, String key, String value) {
-	    Map<String, String> moduleParams = configParams.get(mod.getClass());
-	    if (moduleParams == null) {
-	        moduleParams = new HashMap<String, String>();
-	        configParams.put(mod.getClass(), moduleParams);
-	    }
-	    moduleParams.put(key, value);
-	}
- }
+    @Override
+    public Collection<IFloodlightModule> getAllModules() {
+        return moduleSet;
+    }
+
+    public void setModuleSet(Collection<IFloodlightModule> modSet) {
+        this.moduleSet = modSet;
+    }
+
+    /**
+     * Gets the configuration parameter map for a module
+     *
+     * @param module The module to get the configuration map for, usually yourself
+     * @return A map containing all the configuration parameters for the module, may be empty
+     */
+    @Override
+    public Map<String, String> getConfigParams(IFloodlightModule module) {
+        Map<String, String> retMap = configParams.get(module.getClass());
+        if (retMap == null) {
+            // Return an empty map if none exists so the module does not
+            // need to null check the map
+            retMap = new HashMap<String, String>();
+            configParams.put(module.getClass(), retMap);
+        }
+
+        // also add any configuration parameters for superclasses, but
+        // only if more specific configuration does not override it
+        for (Class<? extends IFloodlightModule> c : configParams.keySet()) {
+            if (c.isInstance(module)) {
+                for (Map.Entry<String, String> ent : configParams.get(c).entrySet()) {
+                    if (!retMap.containsKey(ent.getKey())) {
+                        retMap.put(ent.getKey(), ent.getValue());
+                    }
+                }
+            }
+        }
+
+        return retMap;
+    }
+
+    /**
+     * Adds a configuration parameter for a module
+     *
+     * @param mod   The fully qualified module name to add the parameter to
+     * @param key   The configuration parameter key
+     * @param value The configuration parameter value
+     */
+    public void addConfigParam(IFloodlightModule mod, String key, String value) {
+        Map<String, String> moduleParams = configParams.get(mod.getClass());
+        if (moduleParams == null) {
+            moduleParams = new HashMap<String, String>();
+            configParams.put(mod.getClass(), moduleParams);
+        }
+        moduleParams.put(key, value);
+    }
+}
diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleException.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleException.java
index 20ccc86..8519a3c 100644
--- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleException.java
+++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleException.java
@@ -1,9 +1,9 @@
 package net.floodlightcontroller.core.module;
 
 public class FloodlightModuleException extends Exception {
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	public FloodlightModuleException(String error) {
-		super(error);
-	}
+    public FloodlightModuleException(String error) {
+        super(error);
+    }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
index 5ae7914..6913b1c 100644
--- a/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
+++ b/src/main/java/net/floodlightcontroller/core/module/FloodlightModuleLoader.java
@@ -26,143 +26,145 @@
 
 /**
  * Finds all Floodlight modules in the class path and loads/starts them.
- * @author alexreimers
  *
+ * @author alexreimers
  */
 public class FloodlightModuleLoader {
-    protected final static Logger logger = 
+    protected final static Logger logger =
             LoggerFactory.getLogger(FloodlightModuleLoader.class);
 
     protected static Map<Class<? extends IFloodlightService>,
-                  Collection<IFloodlightModule>> serviceMap;
+            Collection<IFloodlightModule>> serviceMap;
     protected static Map<IFloodlightModule,
-                  Collection<Class<? extends 
-                                   IFloodlightService>>> moduleServiceMap;
+            Collection<Class<? extends
+                    IFloodlightService>>> moduleServiceMap;
     protected static Map<String, IFloodlightModule> moduleNameMap;
     protected static Object lock = new Object();
-    
+
     protected FloodlightModuleContext floodlightModuleContext;
 
     public static final String FLOODLIGHT_MODULES_KEY =
             "floodlight.modules";
-    
-	public FloodlightModuleLoader() {
-	    floodlightModuleContext = new FloodlightModuleContext();
-	}
-	
-	/**
-	 * Finds all IFloodlightModule(s) in the classpath. It creates 3 Maps.
-	 * serviceMap -> Maps a service to a module
-	 * moduleServiceMap -> Maps a module to all the services it provides
-	 * moduleNameMap -> Maps the string name to the module
-	 * @throws FloodlightModuleException If two modules are specified in the configuration
-	 * that provide the same service.
-	 */
-	protected static void findAllModules(Collection<String> mList) throws FloodlightModuleException {
-	    synchronized (lock) {
-	        if (serviceMap != null) return;
-	        serviceMap = 
-	                new HashMap<Class<? extends IFloodlightService>,
-	                            Collection<IFloodlightModule>>();
-	        moduleServiceMap = 
-	                new HashMap<IFloodlightModule,
-	                            Collection<Class<? extends 
-	                                       IFloodlightService>>>();
-	        moduleNameMap = new HashMap<String, IFloodlightModule>();
-	        
-	        // Get all the current modules in the classpath
-	        ClassLoader cl = Thread.currentThread().getContextClassLoader();
-	        ServiceLoader<IFloodlightModule> moduleLoader
-	            = ServiceLoader.load(IFloodlightModule.class, cl);
-	        // Iterate for each module, iterate through and add it's services
-	        Iterator<IFloodlightModule> moduleIter = moduleLoader.iterator();
-	        while (moduleIter.hasNext()) {
-	        	IFloodlightModule m = null;
-	        	try {
-	        		m = moduleIter.next();
-	        	} catch (ServiceConfigurationError sce) {
-	        		logger.debug("Could not find module: {}", sce.getMessage());
-	        		//moduleIter.remove();
-	        		continue;
-	        	}
-	        //}
-	        //for (IFloodlightModule m : moduleLoader) {
-	            if (logger.isDebugEnabled()) {
-	                logger.debug("Found module " + m.getClass().getName());
-	            }
 
-	            // Set up moduleNameMap
-	            moduleNameMap.put(m.getClass().getCanonicalName(), m);
+    public FloodlightModuleLoader() {
+        floodlightModuleContext = new FloodlightModuleContext();
+    }
 
-	            // Set up serviceMap
-	            Collection<Class<? extends IFloodlightService>> servs =
-	                    m.getModuleServices();
-	            if (servs != null) {
-	                moduleServiceMap.put(m, servs);
-	                for (Class<? extends IFloodlightService> s : servs) {
-	                    Collection<IFloodlightModule> mods = 
-	                            serviceMap.get(s);
-	                    if (mods == null) {
-	                        mods = new ArrayList<IFloodlightModule>();
-	                        serviceMap.put(s, mods);
-	                    }
-	                    mods.add(m);
-	                    // Make sure they haven't specified duplicate modules in the config
-	                    int dupInConf = 0;
-	                    for (IFloodlightModule cMod : mods) {
-	                        if (mList.contains(cMod.getClass().getCanonicalName()))
-	                            dupInConf += 1;
-	                    }
-	                    
-	                    if (dupInConf > 1) {
-	                        String duplicateMods = "";
+    /**
+     * Finds all IFloodlightModule(s) in the classpath. It creates 3 Maps.
+     * serviceMap -> Maps a service to a module
+     * moduleServiceMap -> Maps a module to all the services it provides
+     * moduleNameMap -> Maps the string name to the module
+     *
+     * @throws FloodlightModuleException If two modules are specified in the configuration
+     *                                   that provide the same service.
+     */
+    protected static void findAllModules(Collection<String> mList) throws FloodlightModuleException {
+        synchronized (lock) {
+            if (serviceMap != null) return;
+            serviceMap =
+                    new HashMap<Class<? extends IFloodlightService>,
+                            Collection<IFloodlightModule>>();
+            moduleServiceMap =
+                    new HashMap<IFloodlightModule,
+                            Collection<Class<? extends
+                                    IFloodlightService>>>();
+            moduleNameMap = new HashMap<String, IFloodlightModule>();
+
+            // Get all the current modules in the classpath
+            ClassLoader cl = Thread.currentThread().getContextClassLoader();
+            ServiceLoader<IFloodlightModule> moduleLoader
+                    = ServiceLoader.load(IFloodlightModule.class, cl);
+            // Iterate for each module, iterate through and add it's services
+            Iterator<IFloodlightModule> moduleIter = moduleLoader.iterator();
+            while (moduleIter.hasNext()) {
+                IFloodlightModule m = null;
+                try {
+                    m = moduleIter.next();
+                } catch (ServiceConfigurationError sce) {
+                    logger.debug("Could not find module: {}", sce.getMessage());
+                    //moduleIter.remove();
+                    continue;
+                }
+                //}
+                //for (IFloodlightModule m : moduleLoader) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Found module " + m.getClass().getName());
+                }
+
+                // Set up moduleNameMap
+                moduleNameMap.put(m.getClass().getCanonicalName(), m);
+
+                // Set up serviceMap
+                Collection<Class<? extends IFloodlightService>> servs =
+                        m.getModuleServices();
+                if (servs != null) {
+                    moduleServiceMap.put(m, servs);
+                    for (Class<? extends IFloodlightService> s : servs) {
+                        Collection<IFloodlightModule> mods =
+                                serviceMap.get(s);
+                        if (mods == null) {
+                            mods = new ArrayList<IFloodlightModule>();
+                            serviceMap.put(s, mods);
+                        }
+                        mods.add(m);
+                        // Make sure they haven't specified duplicate modules in the config
+                        int dupInConf = 0;
+                        for (IFloodlightModule cMod : mods) {
+                            if (mList.contains(cMod.getClass().getCanonicalName()))
+                                dupInConf += 1;
+                        }
+
+                        if (dupInConf > 1) {
+                            String duplicateMods = "";
                             for (IFloodlightModule mod : mods) {
                                 duplicateMods += mod.getClass().getCanonicalName() + ", ";
                             }
-	                        throw new FloodlightModuleException("ERROR! The configuraiton" +
-	                                " file specifies more than one module that provides the service " +
-	                                s.getCanonicalName() +". Please specify only ONE of the " +
-	                                "following modules in the config file: " + duplicateMods);
-	                    }
-	                }
-	            }
-	        }
-	    }
-	}
-	
-	/**
-	 * Loads the modules from a specified configuration file.
-	 * @param fName The configuration file path
-	 * @return An IFloodlightModuleContext with all the modules to be started
-	 * @throws FloodlightModuleException
-	 */
-	@LogMessageDocs({
-	    @LogMessageDoc(level="INFO",
-	            message="Loading modules from file {file name}",
-	            explanation="The controller is initializing its module " +
-	                    "configuration from the specified properties file"),
-	    @LogMessageDoc(level="INFO",
-	            message="Loading default modules",
-	            explanation="The controller is initializing its module " +
-	                    "configuration to the default configuration"),
-	    @LogMessageDoc(level="ERROR",
-	            message="Could not load module configuration file",
-	            explanation="The controller failed to read the " +
-	            		"module configuration file",
-	            recommendation="Verify that the module configuration is " +
-	            		"present. " + LogMessageDoc.CHECK_CONTROLLER),
-	    @LogMessageDoc(level="ERROR",
-                message="Could not load default modules",
-                explanation="The controller failed to read the default " +
-                        "module configuration",
-                recommendation=LogMessageDoc.CHECK_CONTROLLER)
-	})
-	public IFloodlightModuleContext loadModulesFromConfig(String fName) 
-	        throws FloodlightModuleException {
-	    Properties prop = new Properties();
-	    
-	    File f = new File(fName);
-	    if (f.isFile()) {
+                            throw new FloodlightModuleException("ERROR! The configuraiton" +
+                                    " file specifies more than one module that provides the service " +
+                                    s.getCanonicalName() + ". Please specify only ONE of the " +
+                                    "following modules in the config file: " + duplicateMods);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Loads the modules from a specified configuration file.
+     *
+     * @param fName The configuration file path
+     * @return An IFloodlightModuleContext with all the modules to be started
+     * @throws FloodlightModuleException
+     */
+    @LogMessageDocs({
+            @LogMessageDoc(level = "INFO",
+                    message = "Loading modules from file {file name}",
+                    explanation = "The controller is initializing its module " +
+                            "configuration from the specified properties file"),
+            @LogMessageDoc(level = "INFO",
+                    message = "Loading default modules",
+                    explanation = "The controller is initializing its module " +
+                            "configuration to the default configuration"),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Could not load module configuration file",
+                    explanation = "The controller failed to read the " +
+                            "module configuration file",
+                    recommendation = "Verify that the module configuration is " +
+                            "present. " + LogMessageDoc.CHECK_CONTROLLER),
+            @LogMessageDoc(level = "ERROR",
+                    message = "Could not load default modules",
+                    explanation = "The controller failed to read the default " +
+                            "module configuration",
+                    recommendation = LogMessageDoc.CHECK_CONTROLLER)
+    })
+    public IFloodlightModuleContext loadModulesFromConfig(String fName)
+            throws FloodlightModuleException {
+        Properties prop = new Properties();
+
+        File f = new File(fName);
+        if (f.isFile()) {
             logger.info("Loading modules from file {}", fName);
             try {
                 prop.load(new FileInputStream(fName));
@@ -174,40 +176,41 @@
             logger.error("No configuration file specified");
             System.exit(1);
         }
-        
+
         String moduleList = prop.getProperty(FLOODLIGHT_MODULES_KEY)
-                                .replaceAll("\\s", "");
+                .replaceAll("\\s", "");
         Collection<String> configMods = new ArrayList<String>();
         configMods.addAll(Arrays.asList(moduleList.split(",")));
         return loadModulesFromList(configMods, prop);
-	}
-	
-	/**
-	 * Loads modules (and their dependencies) specified in the list
-	 * @param mList The array of fully qualified module names
-	 * @param ignoreList The list of Floodlight services NOT to 
-	 * load modules for. Used for unit testing.
-	 * @return The ModuleContext containing all the loaded modules
-	 * @throws FloodlightModuleException
-	 */
-	protected IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop, 
-			Collection<IFloodlightService> ignoreList) throws FloodlightModuleException {
-		logger.debug("Starting module loader");
-		if (logger.isDebugEnabled() && ignoreList != null)
-			logger.debug("Not loading module services " + ignoreList.toString());
+    }
+
+    /**
+     * Loads modules (and their dependencies) specified in the list
+     *
+     * @param mList      The array of fully qualified module names
+     * @param ignoreList The list of Floodlight services NOT to
+     *                   load modules for. Used for unit testing.
+     * @return The ModuleContext containing all the loaded modules
+     * @throws FloodlightModuleException
+     */
+    protected IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop,
+                                                           Collection<IFloodlightService> ignoreList) throws FloodlightModuleException {
+        logger.debug("Starting module loader");
+        if (logger.isDebugEnabled() && ignoreList != null)
+            logger.debug("Not loading module services " + ignoreList.toString());
 
         findAllModules(configMods);
-        
+
         Collection<IFloodlightModule> moduleSet = new ArrayList<IFloodlightModule>();
         Map<Class<? extends IFloodlightService>, IFloodlightModule> moduleMap =
                 new HashMap<Class<? extends IFloodlightService>,
-                            IFloodlightModule>();
+                        IFloodlightModule>();
 
         Queue<String> moduleQ = new LinkedList<String>();
         // Add the explicitly configured modules to the q
         moduleQ.addAll(configMods);
         Set<String> modsVisited = new HashSet<String>();
-        
+
         while (!moduleQ.isEmpty()) {
             String moduleName = moduleQ.remove();
             if (modsVisited.contains(moduleName))
@@ -215,37 +218,37 @@
             modsVisited.add(moduleName);
             IFloodlightModule module = moduleNameMap.get(moduleName);
             if (module == null) {
-                throw new FloodlightModuleException("Module " + 
+                throw new FloodlightModuleException("Module " +
                         moduleName + " not found");
             }
             // If the module provies a service that is in the
             // services ignorelist don't load it.
             if ((ignoreList != null) && (module.getModuleServices() != null)) {
-            	for (IFloodlightService ifs : ignoreList) {
-            		for (Class<?> intsIgnore : ifs.getClass().getInterfaces()) {
-            			//System.out.println(intsIgnore.getName());
-        				// Check that the interface extends IFloodlightService
-        				//if (intsIgnore.isAssignableFrom(IFloodlightService.class)) {
-            			//System.out.println(module.getClass().getName());
-    					if (intsIgnore.isAssignableFrom(module.getClass())) {
-    						// We now ignore loading this module.
-    						logger.debug("Not loading module " + 
-    									 module.getClass().getCanonicalName() +
-    									 " because interface " +
-    									 intsIgnore.getCanonicalName() +
-    									 " is in the ignore list.");
-    						
-    						continue;
-    					}
-        				//}
-            		}
-            	}
+                for (IFloodlightService ifs : ignoreList) {
+                    for (Class<?> intsIgnore : ifs.getClass().getInterfaces()) {
+                        //System.out.println(intsIgnore.getName());
+                        // Check that the interface extends IFloodlightService
+                        //if (intsIgnore.isAssignableFrom(IFloodlightService.class)) {
+                        //System.out.println(module.getClass().getName());
+                        if (intsIgnore.isAssignableFrom(module.getClass())) {
+                            // We now ignore loading this module.
+                            logger.debug("Not loading module " +
+                                    module.getClass().getCanonicalName() +
+                                    " because interface " +
+                                    intsIgnore.getCanonicalName() +
+                                    " is in the ignore list.");
+
+                            continue;
+                        }
+                        //}
+                    }
+                }
             }
-            
+
             // Add the module to be loaded
             addModule(moduleMap, moduleSet, module);
             // Add it's dep's to the queue
-            Collection<Class<? extends IFloodlightService>> deps = 
+            Collection<Class<? extends IFloodlightService>> deps =
                     module.getModuleDependencies();
             if (deps != null) {
                 for (Class<? extends IFloodlightService> c : deps) {
@@ -275,11 +278,11 @@
                                 for (IFloodlightModule mod : mods) {
                                     duplicateMods += mod.getClass().getCanonicalName() + ", ";
                                 }
-                                throw new FloodlightModuleException("ERROR! Found more " + 
-                                    "than one (" + mods.size() + ") IFloodlightModules that provides " +
-                                    "service " + c.toString() + 
-                                    ". Please specify one of the following modules in the config: " + 
-                                    duplicateMods);
+                                throw new FloodlightModuleException("ERROR! Found more " +
+                                        "than one (" + mods.size() + ") IFloodlightModules that provides " +
+                                        "service " + c.toString() +
+                                        ". Please specify one of the following modules in the config: " +
+                                        duplicateMods);
                             }
                         }
                     }
@@ -287,93 +290,95 @@
             }
         }
 
-	//
-	// Reorder the moduleSet to take into account the module dependencies:
-	// If a module depends on the service provided by another module, the
-	// latter should be included before the former.
-	//
-	Collection<IFloodlightModule> orderedModuleSet =
-	    new ArrayList<IFloodlightModule>();
-	while (! moduleSet.isEmpty()) {
-	    //
-	    // Evaluate each module in the unsorted collection: if all its
-	    // dependencies are in the orderedModuleSet, then add it to the
-	    // orderedModuleSet.
-	    //
-	    boolean moduleWasSorted = false;
-	    for (IFloodlightModule module : moduleSet) {
-		Collection<Class<? extends IFloodlightService>> deps =
-		    module.getModuleDependencies();
-		boolean allDepsFound = true;
-		if (deps != null) {
-		    for (Class<? extends IFloodlightService> c : deps) {
-			IFloodlightModule m = moduleMap.get(c);
-			// NOTE: Earlier we checked that the module exists
-			assert(m != null);
-			if (! orderedModuleSet.contains(m)) {
-			    allDepsFound = false;
-			    break;
-			}
-		    }
-		}
+        //
+        // Reorder the moduleSet to take into account the module dependencies:
+        // If a module depends on the service provided by another module, the
+        // latter should be included before the former.
+        //
+        Collection<IFloodlightModule> orderedModuleSet =
+                new ArrayList<IFloodlightModule>();
+        while (!moduleSet.isEmpty()) {
+            //
+            // Evaluate each module in the unsorted collection: if all its
+            // dependencies are in the orderedModuleSet, then add it to the
+            // orderedModuleSet.
+            //
+            boolean moduleWasSorted = false;
+            for (IFloodlightModule module : moduleSet) {
+                Collection<Class<? extends IFloodlightService>> deps =
+                        module.getModuleDependencies();
+                boolean allDepsFound = true;
+                if (deps != null) {
+                    for (Class<? extends IFloodlightService> c : deps) {
+                        IFloodlightModule m = moduleMap.get(c);
+                        // NOTE: Earlier we checked that the module exists
+                        assert (m != null);
+                        if (!orderedModuleSet.contains(m)) {
+                            allDepsFound = false;
+                            break;
+                        }
+                    }
+                }
 
-		// Move the module to the sorted collection
-		if (allDepsFound) {
-		    orderedModuleSet.add(module);
-		    moduleSet.remove(module);
-		    moduleWasSorted = true;
-		    break;
-		}
-	    }
+                // Move the module to the sorted collection
+                if (allDepsFound) {
+                    orderedModuleSet.add(module);
+                    moduleSet.remove(module);
+                    moduleWasSorted = true;
+                    break;
+                }
+            }
 
-	    //
-	    // Test for cyclic depenency:
-	    // If no module was sorted, but there are still unsorted modules
-	    // then there is cyclic dependency.
-	    //
-	    if ((! moduleWasSorted) && (! moduleSet.isEmpty())) {
-		String errorMsg = "";
-		for (IFloodlightModule module : moduleSet) {
-		    if (! errorMsg.isEmpty())
-			errorMsg += ", ";
-		    errorMsg += module.getClass().getName();
-		}
-		errorMsg = "ERROR! Cyclic service dependency/dependencies among the following modules: " + errorMsg;
-		throw new FloodlightModuleException(errorMsg);
-	    }
-	}
-	moduleSet = orderedModuleSet;
+            //
+            // Test for cyclic depenency:
+            // If no module was sorted, but there are still unsorted modules
+            // then there is cyclic dependency.
+            //
+            if ((!moduleWasSorted) && (!moduleSet.isEmpty())) {
+                String errorMsg = "";
+                for (IFloodlightModule module : moduleSet) {
+                    if (!errorMsg.isEmpty())
+                        errorMsg += ", ";
+                    errorMsg += module.getClass().getName();
+                }
+                errorMsg = "ERROR! Cyclic service dependency/dependencies among the following modules: " + errorMsg;
+                throw new FloodlightModuleException(errorMsg);
+            }
+        }
+        moduleSet = orderedModuleSet;
 
         floodlightModuleContext.setModuleSet(moduleSet);
         parseConfigParameters(prop);
         initModules(moduleSet);
         startupModules(moduleSet);
-        
+
         return floodlightModuleContext;
-	}
-	
-	/**
-	 * Loads modules (and their dependencies) specified in the list.
-	 * @param configMods The collection of fully qualified module names to load.
-	 * @param prop The list of properties that are configuration options.
-	 * @return The ModuleContext containing all the loaded modules.
-	 * @throws FloodlightModuleException
-	 */
-	public IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop) 
-            throws FloodlightModuleException {
-		return loadModulesFromList(configMods, prop, null);
     }
-	
-	/**
-	 * Add a module to the set of modules to load and register its services
-	 * @param moduleMap the module map
-	 * @param moduleSet the module set
-	 * @param module the module to add
-	 */
-	protected void addModule(Map<Class<? extends IFloodlightService>, 
-                                           IFloodlightModule> moduleMap,
-                            Collection<IFloodlightModule> moduleSet,
-                            IFloodlightModule module) {
+
+    /**
+     * Loads modules (and their dependencies) specified in the list.
+     *
+     * @param configMods The collection of fully qualified module names to load.
+     * @param prop       The list of properties that are configuration options.
+     * @return The ModuleContext containing all the loaded modules.
+     * @throws FloodlightModuleException
+     */
+    public IFloodlightModuleContext loadModulesFromList(Collection<String> configMods, Properties prop)
+            throws FloodlightModuleException {
+        return loadModulesFromList(configMods, prop, null);
+    }
+
+    /**
+     * Add a module to the set of modules to load and register its services
+     *
+     * @param moduleMap the module map
+     * @param moduleSet the module set
+     * @param module    the module to add
+     */
+    protected void addModule(Map<Class<? extends IFloodlightService>,
+            IFloodlightModule> moduleMap,
+                             Collection<IFloodlightModule> moduleSet,
+                             IFloodlightModule module) {
         if (!moduleSet.contains(module)) {
             Collection<Class<? extends IFloodlightService>> servs =
                     moduleServiceMap.get(module);
@@ -383,57 +388,59 @@
             }
             moduleSet.add(module);
         }
-	}
+    }
 
     /**
      * Allocate  service implementations and then init all the modules
+     *
      * @param moduleSet The set of modules to call their init function on
      * @throws FloodlightModuleException If a module can not properly be loaded
      */
-    protected void initModules(Collection<IFloodlightModule> moduleSet) 
-                                           throws FloodlightModuleException {
-        for (IFloodlightModule module : moduleSet) {            
+    protected void initModules(Collection<IFloodlightModule> moduleSet)
+            throws FloodlightModuleException {
+        for (IFloodlightModule module : moduleSet) {
             // Get the module's service instance(s)
-            Map<Class<? extends IFloodlightService>, 
-                IFloodlightService> simpls = module.getServiceImpls();
+            Map<Class<? extends IFloodlightService>,
+                    IFloodlightService> simpls = module.getServiceImpls();
 
             // add its services to the context
             if (simpls != null) {
-                for (Entry<Class<? extends IFloodlightService>, 
+                for (Entry<Class<? extends IFloodlightService>,
                         IFloodlightService> s : simpls.entrySet()) {
                     if (logger.isDebugEnabled()) {
-                        logger.debug("Setting " + s.getValue() + 
-                                     "  as provider for " + 
-                                     s.getKey().getCanonicalName());
+                        logger.debug("Setting " + s.getValue() +
+                                "  as provider for " +
+                                s.getKey().getCanonicalName());
                     }
                     if (floodlightModuleContext.getServiceImpl(s.getKey()) == null) {
                         floodlightModuleContext.addService(s.getKey(),
-                                                           s.getValue());
+                                s.getValue());
                     } else {
                         throw new FloodlightModuleException("Cannot set "
-                                                            + s.getValue()
-                                                            + " as the provider for "
-                                                            + s.getKey().getCanonicalName()
-                                                            + " because "
-                                                            + floodlightModuleContext.getServiceImpl(s.getKey())
-                                                            + " already provides it");
+                                + s.getValue()
+                                + " as the provider for "
+                                + s.getKey().getCanonicalName()
+                                + " because "
+                                + floodlightModuleContext.getServiceImpl(s.getKey())
+                                + " already provides it");
                     }
                 }
             }
         }
-        
+
         for (IFloodlightModule module : moduleSet) {
             // init the module
             if (logger.isDebugEnabled()) {
-                logger.debug("Initializing " + 
-                             module.getClass().getCanonicalName());
+                logger.debug("Initializing " +
+                        module.getClass().getCanonicalName());
             }
             module.init(floodlightModuleContext);
         }
     }
-    
+
     /**
      * Call each loaded module's startup method
+     *
      * @param moduleSet the module set to start up
      */
     protected void startupModules(Collection<IFloodlightModule> moduleSet) {
@@ -444,19 +451,20 @@
             m.startUp(floodlightModuleContext);
         }
     }
-    
+
     /**
      * Parses configuration parameters for each module
+     *
      * @param prop The properties file to use
      */
-    @LogMessageDoc(level="WARN",
-                   message="Module {module} not found or loaded. " +
-                           "Not adding configuration option {key} = {value}",
-                   explanation="Ignoring a configuration parameter for a " +
-                   		"module that is not loaded.")
+    @LogMessageDoc(level = "WARN",
+            message = "Module {module} not found or loaded. " +
+                    "Not adding configuration option {key} = {value}",
+            explanation = "Ignoring a configuration parameter for a " +
+                    "module that is not loaded.")
     protected void parseConfigParameters(Properties prop) {
-    	if (prop == null) return;
-    	
+        if (prop == null) return;
+
         Enumeration<?> e = prop.propertyNames();
         while (e.hasMoreElements()) {
             String key = (String) e.nextElement();
@@ -464,7 +472,7 @@
             if (key.equals(FLOODLIGHT_MODULES_KEY)) {
                 continue;
             }
-            
+
             String configValue = null;
             int lastPeriod = key.lastIndexOf(".");
             String moduleName = key.substring(0, lastPeriod);
@@ -476,12 +484,12 @@
             } else {
                 configValue = prop.getProperty(key);
             }
-            
+
             IFloodlightModule mod = moduleNameMap.get(moduleName);
             if (mod == null) {
                 logger.warn("Module {} not found or loaded. " +
-                		    "Not adding configuration option {} = {}", 
-                            new Object[]{moduleName, configKey, configValue});
+                        "Not adding configuration option {} = {}",
+                        new Object[]{moduleName, configKey, configValue});
             } else {
                 floodlightModuleContext.addConfigParam(mod, configKey, configValue);
             }
diff --git a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModule.java b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModule.java
index f8b196b..c616bc0 100644
--- a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModule.java
+++ b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModule.java
@@ -6,7 +6,7 @@
 
 /**
  * Defines an interface for loadable Floodlight modules.
- * 
+ * <p/>
  * At a high level, these functions are called in the following order:
  * <ol>
  * <li> getServices() : what services does this module provide
@@ -14,61 +14,64 @@
  * <li> init() : internal initializations (don't touch other modules)
  * <li> startUp() : external initializations (<em>do</em> touch other modules)
  * </ol>
- * 
+ *
  * @author alexreimers
  */
 public interface IFloodlightModule {
-	
-	/**
-	 * Return the list of interfaces that this module implements.
-	 * All interfaces must inherit IFloodlightService
-	 * @return
-	 */
-	
-	public Collection<Class<? extends IFloodlightService>> getModuleServices();
-	
-	/**
-	 * Instantiate (as needed) and return objects that implement each
-	 * of the services exported by this module.  The map returned maps
-	 * the implemented service to the object.  The object could be the
-	 * same object or different objects for different exported services.
-	 * @return The map from service interface class to service implementation
-	 */
-	public Map<Class<? extends IFloodlightService>,
-	           IFloodlightService> getServiceImpls();
-	
-	/**
-	 * Get a list of Modules that this module depends on.  The module system
-	 * will ensure that each these dependencies is resolved before the 
-	 * subsequent calls to init().
-	 * @return The Collection of IFloodlightServices that this module depends
-	 *         on.
-	 */
-	
-	public Collection<Class<? extends IFloodlightService>> getModuleDependencies();
-	
-	/**
-	 * This is a hook for each module to do its <em>internal</em> initialization, 
-	 * e.g., call setService(context.getService("Service"))
-	 * 
-	 * All module dependencies are resolved when this is called, but not every module 
-	 * is initialized.
-	 * 
-	 * @param context
-	 * @throws FloodlightModuleException
-	 */
-	
-	void init(FloodlightModuleContext context) throws FloodlightModuleException;
-	
-	/**
-	 * This is a hook for each module to do its <em>external</em> initializations,
-	 * e.g., register for callbacks or query for state in other modules
-	 * 
-	 * It is expected that this function will not block and that modules that want
-	 * non-event driven CPU will spawn their own threads.
-	 * 
-	 * @param context
-	 */
-	
-	void startUp(FloodlightModuleContext context); 
+
+    /**
+     * Return the list of interfaces that this module implements.
+     * All interfaces must inherit IFloodlightService
+     *
+     * @return
+     */
+
+    public Collection<Class<? extends IFloodlightService>> getModuleServices();
+
+    /**
+     * Instantiate (as needed) and return objects that implement each
+     * of the services exported by this module.  The map returned maps
+     * the implemented service to the object.  The object could be the
+     * same object or different objects for different exported services.
+     *
+     * @return The map from service interface class to service implementation
+     */
+    public Map<Class<? extends IFloodlightService>,
+            IFloodlightService> getServiceImpls();
+
+    /**
+     * Get a list of Modules that this module depends on.  The module system
+     * will ensure that each these dependencies is resolved before the
+     * subsequent calls to init().
+     *
+     * @return The Collection of IFloodlightServices that this module depends
+     * on.
+     */
+
+    public Collection<Class<? extends IFloodlightService>> getModuleDependencies();
+
+    /**
+     * This is a hook for each module to do its <em>internal</em> initialization,
+     * e.g., call setService(context.getService("Service"))
+     * <p/>
+     * All module dependencies are resolved when this is called, but not every module
+     * is initialized.
+     *
+     * @param context
+     * @throws FloodlightModuleException
+     */
+
+    void init(FloodlightModuleContext context) throws FloodlightModuleException;
+
+    /**
+     * This is a hook for each module to do its <em>external</em> initializations,
+     * e.g., register for callbacks or query for state in other modules
+     * <p/>
+     * It is expected that this function will not block and that modules that want
+     * non-event driven CPU will spawn their own threads.
+     *
+     * @param context
+     */
+
+    void startUp(FloodlightModuleContext context);
 }
diff --git a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java
index 2c058a7..cdaadc3 100644
--- a/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java
+++ b/src/main/java/net/floodlightcontroller/core/module/IFloodlightModuleContext.java
@@ -3,31 +3,35 @@
 import java.util.Collection;
 import java.util.Map;
 
-	
-public interface IFloodlightModuleContext {	
+
+public interface IFloodlightModuleContext {
     /**
      * Retrieves a casted version of a module from the registry.
+     *
      * @param name The IFloodlightService object type
      * @return The IFloodlightService
-     * @throws FloodlightModuleException If the module was not found 
-     * or a ClassCastException was encountered.
+     * @throws FloodlightModuleException If the module was not found
+     *                                   or a ClassCastException was encountered.
      */
     public <T extends IFloodlightService> T getServiceImpl(Class<T> service);
-    
+
     /**
      * Returns all loaded services
+     *
      * @return A collection of service classes that have been loaded
      */
     public Collection<Class<? extends IFloodlightService>> getAllServices();
-    
+
     /**
      * Returns all loaded modules
+     *
      * @return All Floodlight modules that are going to be loaded
      */
     public Collection<IFloodlightModule> getAllModules();
-    
+
     /**
      * Gets module specific configuration parameters.
+     *
      * @param module The module to get the configuration parameters for
      * @return A key, value map of the configuration options
      */
diff --git a/src/main/java/net/floodlightcontroller/core/module/IFloodlightService.java b/src/main/java/net/floodlightcontroller/core/module/IFloodlightService.java
index 5974b3a..b59c62b 100644
--- a/src/main/java/net/floodlightcontroller/core/module/IFloodlightService.java
+++ b/src/main/java/net/floodlightcontroller/core/module/IFloodlightService.java
@@ -1,10 +1,10 @@
 package net.floodlightcontroller.core.module;
 
 /**
- * This is the base interface for any IFloodlightModule package that provides 
+ * This is the base interface for any IFloodlightModule package that provides
  * a service.
- * @author alexreimers
  *
+ * @author alexreimers
  */
 public abstract interface IFloodlightService {
     // This space is intentionally left blank....don't touch it
diff --git a/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java b/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
index 556b26d..21cbfc3 100644
--- a/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
+++ b/src/main/java/net/floodlightcontroller/core/module/ModuleLoaderResource.java
@@ -13,91 +13,94 @@
 
 /**
  * Returns list of modules loaded by Floodlight.
+ *
  * @author Rob Sherwood
  */
 public class ModuleLoaderResource extends ServerResource {
-    protected final static Logger log = 
+    protected final static Logger log =
             LoggerFactory.getLogger(ModuleLoaderResource.class);
-    
+
     /**
      * Retrieves information about loaded modules.
+     *
      * @return Information about loaded modules.
      */
     @Get("json")
     public Map<String, Object> retrieve() {
-    	return retrieveInternal(false);
+        return retrieveInternal(false);
     }
-    
+
     /**
      * Retrieves all modules and their dependencies available
      * to Floodlight.
+     *
      * @param loadedOnly Whether to return all modules available or only the ones loaded.
      * @return Information about modules available or loaded.
      */
-    public Map<String, Object> retrieveInternal(boolean loadedOnly) {    
+    public Map<String, Object> retrieveInternal(boolean loadedOnly) {
         Map<String, Object> model = new HashMap<String, Object>();
 
         Set<String> loadedModules = new HashSet<String>();
         for (Object val : getContext().getAttributes().values()) {
-        	if ((val instanceof IFloodlightModule) || (val instanceof IFloodlightService)) {
-        		String serviceImpl = val.getClass().getCanonicalName();
-        		loadedModules.add(serviceImpl);
-        		// log.debug("Tracking serviceImpl " + serviceImpl);
-        	}
+            if ((val instanceof IFloodlightModule) || (val instanceof IFloodlightService)) {
+                String serviceImpl = val.getClass().getCanonicalName();
+                loadedModules.add(serviceImpl);
+                // log.debug("Tracking serviceImpl " + serviceImpl);
+            }
         }
 
-        for (String moduleName : 
-        				FloodlightModuleLoader.moduleNameMap.keySet() ) {
-        	Map<String,Object> moduleInfo = new HashMap<String, Object>();
+        for (String moduleName :
+                FloodlightModuleLoader.moduleNameMap.keySet()) {
+            Map<String, Object> moduleInfo = new HashMap<String, Object>();
 
-        	IFloodlightModule module = 
-        				FloodlightModuleLoader.moduleNameMap.get(
-        						moduleName);
-        		
-        	Collection<Class<? extends IFloodlightService>> deps = 
-        			module.getModuleDependencies();
-        	if ( deps == null)
-            	deps = new HashSet<Class<? extends IFloodlightService>>();
-        	Map<String,Object> depsMap = new HashMap<String, Object> ();
-        	for (Class<? extends IFloodlightService> service : deps) {
-        		Object serviceImpl = getContext().getAttributes().get(service.getCanonicalName());
-        		if (serviceImpl != null)
-        			depsMap.put(service.getCanonicalName(), serviceImpl.getClass().getCanonicalName());
-        		else
-        			depsMap.put(service.getCanonicalName(), "<unresolved>");
+            IFloodlightModule module =
+                    FloodlightModuleLoader.moduleNameMap.get(
+                            moduleName);
 
-        	}
+            Collection<Class<? extends IFloodlightService>> deps =
+                    module.getModuleDependencies();
+            if (deps == null)
+                deps = new HashSet<Class<? extends IFloodlightService>>();
+            Map<String, Object> depsMap = new HashMap<String, Object>();
+            for (Class<? extends IFloodlightService> service : deps) {
+                Object serviceImpl = getContext().getAttributes().get(service.getCanonicalName());
+                if (serviceImpl != null)
+                    depsMap.put(service.getCanonicalName(), serviceImpl.getClass().getCanonicalName());
+                else
+                    depsMap.put(service.getCanonicalName(), "<unresolved>");
+
+            }
             moduleInfo.put("depends", depsMap);
-        	
-            Collection<Class<? extends IFloodlightService>> provides = 
-            		module.getModuleServices();
-        	if ( provides == null)
-            	provides = new HashSet<Class<? extends IFloodlightService>>();
-        	Map<String,Object> providesMap = new HashMap<String,Object>();
-        	for (Class<? extends IFloodlightService> service : provides) {
-        		providesMap.put(service.getCanonicalName(), module.getServiceImpls().get(service).getClass().getCanonicalName());
-        	}
-        	moduleInfo.put("provides", providesMap);            		
 
-    		moduleInfo.put("loaded", false);	// not loaded, by default
+            Collection<Class<? extends IFloodlightService>> provides =
+                    module.getModuleServices();
+            if (provides == null)
+                provides = new HashSet<Class<? extends IFloodlightService>>();
+            Map<String, Object> providesMap = new HashMap<String, Object>();
+            for (Class<? extends IFloodlightService> service : provides) {
+                providesMap.put(service.getCanonicalName(), module.getServiceImpls().get(service).getClass().getCanonicalName());
+            }
+            moduleInfo.put("provides", providesMap);
 
-        	// check if this module is loaded directly
-        	if (loadedModules.contains(module.getClass().getCanonicalName())) {
-        		moduleInfo.put("loaded", true);  			
-        	} else {
-        		// if not, then maybe one of the services it exports is loaded
-        		for (Class<? extends IFloodlightService> service : provides) {
-        			String modString = module.getServiceImpls().get(service).getClass().getCanonicalName();
-        			if (loadedModules.contains(modString))
-                		moduleInfo.put("loaded", true);
-        			/* else 
-        				log.debug("ServiceImpl not loaded " + modString); */
-        		}
-        	}
+            moduleInfo.put("loaded", false);        // not loaded, by default
 
-        	if ((Boolean)moduleInfo.get("loaded")|| !loadedOnly )
-        		model.put(moduleName, moduleInfo);
-        }            
+            // check if this module is loaded directly
+            if (loadedModules.contains(module.getClass().getCanonicalName())) {
+                moduleInfo.put("loaded", true);
+            } else {
+                // if not, then maybe one of the services it exports is loaded
+                for (Class<? extends IFloodlightService> service : provides) {
+                    String modString = module.getServiceImpls().get(service).getClass().getCanonicalName();
+                    if (loadedModules.contains(modString))
+                        moduleInfo.put("loaded", true);
+                                /* else 
+                                        log.debug("ServiceImpl not loaded " + modString); */
+                }
+            }
+
+            if ((Boolean) moduleInfo.get("loaded") || !loadedOnly)
+                model.put(moduleName, moduleInfo);
+        }
         return model;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/util/AppCookie.java b/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
index 210823e..3ec3bd8 100644
--- a/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
+++ b/src/main/java/net/floodlightcontroller/core/util/AppCookie.java
@@ -1,27 +1,26 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.util;
 
-/***
+/**
  * FIXME Need a system for registering/binding applications to a unique ID
- * 
- * @author capveg
  *
+ * @author capveg
  */
 
 public class AppCookie {
@@ -34,21 +33,21 @@
 
     /**
      * Encapsulate an application ID and a user block of stuff into a cookie
-     * 
+     *
      * @param application An ID to identify the application
-     * @param user Some application specific data
+     * @param user        Some application specific data
      * @return a cookie for use in OFFlowMod.setCookie()
      */
-    
+
     static public long makeCookie(int application, int user) {
         return ((application & ((1L << APP_ID_BITS) - 1)) << APP_ID_SHIFT) | user;
     }
-    
+
     static public int extractApp(long cookie) {
-        return (int)((cookie>> APP_ID_SHIFT) & ((1L << APP_ID_BITS) - 1));
+        return (int) ((cookie >> APP_ID_SHIFT) & ((1L << APP_ID_BITS) - 1));
     }
-    
+
     static public int extractUser(long cookie) {
-        return (int)((cookie>> USER_SHIFT) & ((1L << USER_BITS) - 1));
+        return (int) ((cookie >> USER_SHIFT) & ((1L << USER_BITS) - 1));
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
index 911284e..f716f4b 100644
--- a/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
+++ b/src/main/java/net/floodlightcontroller/core/util/ListenerDispatcher.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.util;
 
@@ -28,20 +28,19 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * Maintain lists of listeners ordered by dependency.  
- * 
- * @author readams
+ * Maintain lists of listeners ordered by dependency.
  *
+ * @author readams
  */
 public class ListenerDispatcher<U, T extends IListener<U>> {
     protected final static Logger logger = LoggerFactory.getLogger(ListenerDispatcher.class);
     List<T> listeners = null;
-    
-    private void visit(List<T> newlisteners, U type, HashSet<T> visited, 
+
+    private void visit(List<T> newlisteners, U type, HashSet<T> visited,
                        List<T> ordering, T listener) {
         if (!visited.contains(listener)) {
             visited.add(listener);
-            
+
             for (T i : newlisteners) {
                 if (ispre(type, i, listener)) {
                     visit(newlisteners, type, visited, ordering, i);
@@ -50,24 +49,25 @@
             ordering.add(listener);
         }
     }
-    
+
     private boolean ispre(U type, T l1, T l2) {
         return (l2.isCallbackOrderingPrereq(type, l1.getName()) ||
                 l1.isCallbackOrderingPostreq(type, l2.getName()));
     }
-    
+
     /**
      * Add a listener to the list of listeners
+     *
      * @param listener
      */
-    @LogMessageDoc(level="ERROR",
-                   message="No listener dependency solution: " +
-                           "No listeners without incoming dependencies",
-                   explanation="The set of listeners installed " +
-                   		"have dependencies with no solution",
-                   recommendation="Install a different set of listeners " +
-                   		"or install all dependencies.  This is a defect in " +
-                   		"the controller installation.")
+    @LogMessageDoc(level = "ERROR",
+            message = "No listener dependency solution: " +
+                    "No listeners without incoming dependencies",
+            explanation = "The set of listeners installed " +
+                    "have dependencies with no solution",
+            recommendation = "Install a different set of listeners " +
+                    "or install all dependencies.  This is a defect in " +
+                    "the controller installation.")
     public void addListener(U type, T listener) {
         List<T> newlisteners = new ArrayList<T>();
         if (listeners != null)
@@ -75,7 +75,7 @@
 
         newlisteners.add(listener);
         // Find nodes without outgoing edges
-        List<T> terminals = new ArrayList<T>(); 
+        List<T> terminals = new ArrayList<T>();
         for (T i : newlisteners) {
             boolean isterm = true;
             for (T j : newlisteners) {
@@ -88,18 +88,18 @@
                 terminals.add(i);
             }
         }
-        
+
         if (terminals.size() == 0) {
             logger.error("No listener dependency solution: " +
-            		     "No listeners without incoming dependencies");
+                    "No listeners without incoming dependencies");
             listeners = newlisteners;
             return;
         }
-        
+
         // visit depth-first traversing in the opposite order from
         // the dependencies.  Note we will not generally detect cycles
         HashSet<T> visited = new HashSet<T>();
-        List<T> ordering = new ArrayList<T>(); 
+        List<T> ordering = new ArrayList<T>();
         for (T term : terminals) {
             visit(newlisteners, type, visited, ordering, term);
         }
@@ -108,6 +108,7 @@
 
     /**
      * Remove the given listener
+     *
      * @param listener the listener to remove
      */
     public void removeListener(T listener) {
@@ -118,16 +119,17 @@
             listeners = newlisteners;
         }
     }
-    
+
     /**
      * Clear all listeners
      */
     public void clearListeners() {
         listeners = new ArrayList<T>();
     }
-    
-    /** 
-     * Get the ordered list of listeners ordered by dependencies 
+
+    /**
+     * Get the ordered list of listeners ordered by dependencies
+     *
      * @return
      */
     public List<T> getOrderedListeners() {
diff --git a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java b/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
index 0f070fa..6ac3231 100644
--- a/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
+++ b/src/main/java/net/floodlightcontroller/core/util/MutableInteger.java
@@ -1,34 +1,34 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.util;
 
 public class MutableInteger extends Number {
     private static final long serialVersionUID = 1L;
     int mutableInt;
-    
+
     public MutableInteger(int value) {
         this.mutableInt = value;
     }
-    
+
     public void setValue(int value) {
         this.mutableInt = value;
     }
-    
+
     @Override
     public double doubleValue() {
         return (double) mutableInt;
diff --git a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
index 0e03144..2338acc 100644
--- a/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
+++ b/src/main/java/net/floodlightcontroller/core/util/SingletonTask.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.util;
 
@@ -27,26 +27,26 @@
 
 /**
  * This allows you to represent a task that should be queued for future execution
- * but where you only want the task to complete once in response to some sequence 
+ * but where you only want the task to complete once in response to some sequence
  * of events.  For example, if you get a change notification and want to reload state,
  * you only want to reload the state once, at the end, and don't want to queue
  * an update for every notification that might come in.
- * 
+ * <p/>
  * The semantics are as follows:
  * * If the task hasn't begun yet, do not queue a new task
  * * If the task has begun, set a bit to restart it after the current task finishes
  */
 public class SingletonTask {
     protected final static Logger logger = LoggerFactory.getLogger(SingletonTask.class);
-            
-    protected static class SingletonTaskContext  {
+
+    protected static class SingletonTaskContext {
         protected boolean taskShouldRun = false;
         protected boolean taskRunning = false;
 
         protected SingletonTaskWorker waitingTask = null;
     }
 
-    protected static class SingletonTaskWorker implements Runnable  {
+    protected static class SingletonTaskWorker implements Runnable {
         SingletonTask parent;
         boolean canceled = false;
         long nextschedule = 0;
@@ -57,9 +57,9 @@
         }
 
         @Override
-        @LogMessageDoc(level="ERROR",
-                       message="Exception while executing task",
-                       recommendation=LogMessageDoc.GENERIC_ACTION)
+        @LogMessageDoc(level = "ERROR",
+                message = "Exception while executing task",
+                recommendation = LogMessageDoc.GENERIC_ACTION)
         public void run() {
             synchronized (parent.context) {
                 if (canceled || !parent.context.taskShouldRun)
@@ -83,9 +83,9 @@
                     if ((nextschedule <= 0 || (nextschedule - now) <= 0)) {
                         parent.ses.execute(this);
                     } else {
-                        parent.ses.schedule(this, 
-                                            nextschedule-now, 
-                                            TimeUnit.NANOSECONDS);
+                        parent.ses.schedule(this,
+                                nextschedule - now,
+                                TimeUnit.NANOSECONDS);
                     }
                 }
             }
@@ -101,11 +101,12 @@
      * Construct a new SingletonTask for the given runnable.  The context
      * is used to manage the state of the task execution and can be shared
      * by more than one instance of the runnable.
+     *
      * @param context
      * @param Task
      */
     public SingletonTask(ScheduledExecutorService ses,
-            Runnable task) {
+                         Runnable task) {
         super();
         this.task = task;
         this.ses = ses;
@@ -117,9 +118,9 @@
      * cancel that task and reschedule it to run at the given time.  If the
      * task is already started, it will cause the task to be rescheduled once
      * it completes to run after delay from the time of reschedule.
-     * 
+     *
      * @param delay the delay in scheduling
-     * @param unit the timeunit of the delay
+     * @param unit  the timeunit of the delay
      */
     public void reschedule(long delay, TimeUnit unit) {
         boolean needQueue = true;
@@ -131,8 +132,8 @@
                     // schedule to restart at the right time
                     if (delay > 0) {
                         long now = System.nanoTime();
-                        long then = 
-                            now + TimeUnit.NANOSECONDS.convert(delay, unit);
+                        long then =
+                                now + TimeUnit.NANOSECONDS.convert(delay, unit);
                         context.waitingTask.nextschedule = then;
                     } else {
                         context.waitingTask.nextschedule = 0;
@@ -148,7 +149,7 @@
             context.taskShouldRun = true;
 
             if (needQueue) {
-                stw = context.waitingTask = new SingletonTaskWorker(this);                    
+                stw = context.waitingTask = new SingletonTaskWorker(this);
             }
         }
 
diff --git a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
index 5d70cee..276215b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -35,24 +35,25 @@
 
 /**
  * Return switch statistics information for all switches
+ *
  * @author readams
  */
 public class AllSwitchStatisticsResource extends SwitchResourceBase {
-    protected final static Logger log = 
-        LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
-    
+    protected final static Logger log =
+            LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
+
     @Get("json")
-    public Map<String, Object> retrieve() {    
+    public Map<String, Object> retrieve() {
         String statType = (String) getRequestAttributes().get("statType");
         return retrieveInternal(statType);
     }
-        
+
     public Map<String, Object> retrieveInternal(String statType) {
         HashMap<String, Object> model = new HashMap<String, Object>();
 
         OFStatisticsType type = null;
         REQUESTTYPE rType = null;
-        
+
         if (statType.equals("port")) {
             type = OFStatisticsType.PORT;
             rType = REQUESTTYPE.OFSTATS;
@@ -76,10 +77,10 @@
         } else {
             return model;
         }
-        
-        IFloodlightProviderService floodlightProvider = 
-                (IFloodlightProviderService)getContext().getAttributes().
-                    get(IFloodlightProviderService.class.getCanonicalName());        
+
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
         Long[] switchDpids = floodlightProvider.getSwitches().keySet().toArray(new Long[0]);
         List<GetConcurrentStatsThread> activeThreads = new ArrayList<GetConcurrentStatsThread>(switchDpids.length);
         List<GetConcurrentStatsThread> pendingRemovalThreads = new ArrayList<GetConcurrentStatsThread>();
@@ -89,7 +90,7 @@
             activeThreads.add(t);
             t.start();
         }
-        
+
         // Join all the threads after the timeout. Set a hard timeout
         // of 12 seconds for the threads to finish. If the thread has not
         // finished the switch has not replied yet and therefore we won't 
@@ -105,19 +106,19 @@
                     pendingRemovalThreads.add(curThread);
                 }
             }
-            
+
             // remove the threads that have completed the queries to the switches
             for (GetConcurrentStatsThread curThread : pendingRemovalThreads) {
                 activeThreads.remove(curThread);
             }
             // clear the list so we don't try to double remove them
             pendingRemovalThreads.clear();
-            
+
             // if we are done finish early so we don't always get the worst case
             if (activeThreads.isEmpty()) {
                 break;
             }
-            
+
             // sleep for 1 s here
             try {
                 Thread.sleep(1000);
@@ -125,17 +126,17 @@
                 log.error("Interrupted while waiting for statistics", e);
             }
         }
-        
+
         return model;
     }
-    
+
     protected class GetConcurrentStatsThread extends Thread {
         private List<OFStatistics> switchReply;
         private long switchId;
         private OFStatisticsType statType;
         private REQUESTTYPE requestType;
         private OFFeaturesReply featuresReply;
-        
+
         public GetConcurrentStatsThread(long switchId, REQUESTTYPE requestType, OFStatisticsType statType) {
             this.switchId = switchId;
             this.requestType = requestType;
@@ -143,19 +144,19 @@
             this.switchReply = null;
             this.featuresReply = null;
         }
-        
+
         public List<OFStatistics> getStatisticsReply() {
             return switchReply;
         }
-        
+
         public OFFeaturesReply getFeaturesReply() {
             return featuresReply;
         }
-        
+
         public long getSwitchId() {
             return switchId;
         }
-        
+
         public void run() {
             if ((requestType == REQUESTTYPE.OFSTATS) && (statType != null)) {
                 switchReply = getSwitchStatistics(switchId, statType);
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
index bcb2bd1..371a38f 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerMemoryResource.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -25,6 +25,7 @@
 
 /**
  * Retrieve floodlight memory state
+ *
  * @author readams
  */
 public class ControllerMemoryResource extends ServerResource {
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
index 454f566..223da56 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -32,21 +32,22 @@
 
 /**
  * Get a list of switches connected to the controller
+ *
  * @author readams
  */
 public class ControllerSwitchesResource extends ServerResource {
-    public static final String DPID_ERROR = 
-            "Invalid Switch DPID: must be a 64-bit quantity, expressed in " + 
-            "hex as AA:BB:CC:DD:EE:FF:00:11";
-    
+    public static final String DPID_ERROR =
+            "Invalid Switch DPID: must be a 64-bit quantity, expressed in " +
+                    "hex as AA:BB:CC:DD:EE:FF:00:11";
+
     @Get("json")
     public Iterator<IOFSwitch> retrieve() {
-        IFloodlightProviderService floodlightProvider = 
-                (IFloodlightProviderService)getContext().getAttributes().
-                    get(IFloodlightProviderService.class.getCanonicalName());
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
 
         Long switchDPID = null;
-        
+
         Form form = getQuery();
         String dpid = form.getFirstValue("dpid", true);
         if (dpid != null) {
@@ -58,15 +59,15 @@
             }
         }
         if (switchDPID != null) {
-            IOFSwitch sw = 
+            IOFSwitch sw =
                     floodlightProvider.getSwitches().get(switchDPID);
             if (sw != null)
                 return Collections.singleton(sw).iterator();
             return Collections.<IOFSwitch>emptySet().iterator();
         }
-        final String dpidStartsWith = 
+        final String dpidStartsWith =
                 form.getFirstValue("dpid__startswith", true);
-        Iterator<IOFSwitch> switer = 
+        Iterator<IOFSwitch> switer =
                 floodlightProvider.getSwitches().values().iterator();
         if (dpidStartsWith != null) {
             return new FilterIterator<IOFSwitch>(switer) {
@@ -75,7 +76,7 @@
                     return value.getStringId().startsWith(dpidStartsWith);
                 }
             };
-        } 
+        }
         return switer;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
index 0e48975..4492643 100644
--- a/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
+++ b/src/main/java/net/floodlightcontroller/core/web/CoreWebRoutable.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -26,6 +26,7 @@
 
 /**
  * Creates a router to handle all the core web URIs
+ *
  * @author readams
  */
 public class CoreWebRoutable implements RestletRoutable {
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
index 56ff6d9..2bbb1bd 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyClusterResource.java
@@ -12,34 +12,32 @@
 
 /**
  * @author subrata
- *
  */
 public class EventHistoryTopologyClusterResource extends ServerResource {
     // TODO - Move this to the LinkDiscovery rest API
-    protected final static Logger log = 
+    protected final static Logger log =
             LoggerFactory.getLogger(EventHistoryTopologyClusterResource.class);
 
     @Get("json")
     public EventHistory<EventHistoryTopologyCluster> handleEvHistReq() {
 
         // Get the event history count. Last <count> events would be returned
-        String evHistCount = (String)getRequestAttributes().get("count");
-        int    count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+        String evHistCount = (String) getRequestAttributes().get("count");
+        int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
         try {
             count = Integer.parseInt(evHistCount);
-        }
-        catch(NumberFormatException nFE) {
+        } catch (NumberFormatException nFE) {
             // Invalid input for event count - use default value
         }
 
         LinkDiscoveryManager topoManager =
-                (LinkDiscoveryManager)getContext().getAttributes().
-                get(ILinkDiscoveryService.class.getCanonicalName());
+                (LinkDiscoveryManager) getContext().getAttributes().
+                        get(ILinkDiscoveryService.class.getCanonicalName());
         if (topoManager != null) {
             return new EventHistory<EventHistoryTopologyCluster>(
                     topoManager.evHistTopologyCluster, count);
         }
-        
+
         return null;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
index fbb2e76..90d9198 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologyLinkResource.java
@@ -12,34 +12,32 @@
 
 /**
  * @author subrata
- *
  */
 public class EventHistoryTopologyLinkResource extends ServerResource {
     // TODO - Move this to the DeviceManager Rest API
-    protected final static Logger log = 
+    protected final static Logger log =
             LoggerFactory.getLogger(EventHistoryTopologyLinkResource.class);
 
     @Get("json")
     public EventHistory<EventHistoryTopologyLink> handleEvHistReq() {
 
         // Get the event history count. Last <count> events would be returned
-        String evHistCount = (String)getRequestAttributes().get("count");
-        int    count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+        String evHistCount = (String) getRequestAttributes().get("count");
+        int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
         try {
             count = Integer.parseInt(evHistCount);
-        }
-        catch(NumberFormatException nFE) {
+        } catch (NumberFormatException nFE) {
             // Invalid input for event count - use default value
         }
 
         LinkDiscoveryManager linkDiscoveryManager =
-                (LinkDiscoveryManager)getContext().getAttributes().
-                get(ILinkDiscoveryService.class.getCanonicalName());
+                (LinkDiscoveryManager) getContext().getAttributes().
+                        get(ILinkDiscoveryService.class.getCanonicalName());
         if (linkDiscoveryManager != null) {
             return new EventHistory<EventHistoryTopologyLink>(
                     linkDiscoveryManager.evHistTopologyLink, count);
         }
-        
+
         return null;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
index 345020b..e1fbb1b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/EventHistoryTopologySwitchResource.java
@@ -10,7 +10,6 @@
 
 /**
  * @author subrata
- *
  */
 public class EventHistoryTopologySwitchResource extends ServerResource {
 
@@ -18,20 +17,19 @@
     public EventHistory<EventHistoryTopologySwitch> handleEvHistReq() {
 
         // Get the event history count. Last <count> events would be returned
-        String evHistCount = (String)getRequestAttributes().get("count");
-        int    count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
+        String evHistCount = (String) getRequestAttributes().get("count");
+        int count = EventHistory.EV_HISTORY_DEFAULT_SIZE;
         try {
             count = Integer.parseInt(evHistCount);
-        }
-        catch(NumberFormatException nFE) {
+        } catch (NumberFormatException nFE) {
             // Invalid input for event count - use default value
         }
 
         LinkDiscoveryManager topoManager =
-           (LinkDiscoveryManager)getContext().getAttributes().
-               get(ILinkDiscoveryService.class.getCanonicalName());
+                (LinkDiscoveryManager) getContext().getAttributes().
+                        get(ILinkDiscoveryService.class.getCanonicalName());
 
         return new EventHistory<EventHistoryTopologySwitch>(
-                                topoManager.evHistTopologySwitch, count);
+                topoManager.evHistTopologySwitch, count);
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java b/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
index 12ee545..a0d5c0c 100644
--- a/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/HealthCheckResource.java
@@ -4,24 +4,24 @@
 import org.restlet.resource.ServerResource;
 
 public class HealthCheckResource extends ServerResource {
-    
+
     public static class HealthCheckInfo {
-        
+
         protected boolean healthy;
-        
+
         public HealthCheckInfo() {
             this.healthy = true;
         }
-        
+
         public boolean isHealthy() {
             return healthy;
         }
-        
+
         public void setHealthy(boolean healthy) {
             this.healthy = healthy;
         }
     }
-    
+
     @Get("json")
     public HealthCheckInfo healthCheck() {
         // Currently this is the simplest possible health check -- basically
diff --git a/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java b/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
index 22bdb77..0ffc7b0 100644
--- a/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/LoadedModuleLoaderResource.java
@@ -7,13 +7,14 @@
 import org.restlet.resource.Get;
 
 public class LoadedModuleLoaderResource extends ModuleLoaderResource {
-	/**
-	 * Retrieves information about all modules available
-	 * to Floodlight.
-	 * @return Information about all modules available.
-	 */
+    /**
+     * Retrieves information about all modules available
+     * to Floodlight.
+     *
+     * @return Information about all modules available.
+     */
     @Get("json")
     public Map<String, Object> retrieve() {
-    	return retrieveInternal(true);
+        return retrieveInternal(true);
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java b/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
index e600ea0..879eb04 100644
--- a/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
+++ b/src/main/java/net/floodlightcontroller/core/web/RoleInfo.java
@@ -4,22 +4,22 @@
 
 public class RoleInfo {
     protected String role;
-    
+
     public RoleInfo() {
     }
-    
+
     public RoleInfo(String role) {
         setRole(role);
     }
-    
+
     public RoleInfo(Role role) {
         this.role = (role != null) ? role.name() : "DISABLED";
     }
-    
+
     public String getRole() {
         return role;
     }
-    
+
     public void setRole(String role) {
         this.role = role;
     }
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
index 1c138f6..835cb17 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -44,35 +44,35 @@
 
 /**
  * Base class for server resources related to switches
- * @author readams
  *
+ * @author readams
  */
 public class SwitchResourceBase extends ServerResource {
     protected final static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
-    
+
     public enum REQUESTTYPE {
         OFSTATS,
         OFFEATURES
     }
-    
+
     @Override
     protected void doInit() throws ResourceException {
         super.doInit();
-        
+
     }
-    
-    @LogMessageDoc(level="ERROR",
-                   message="Failure retrieving statistics from switch {switch}",
-                   explanation="An error occurred while retrieving statistics" +
-                   		"from the switch",
-                   recommendation=LogMessageDoc.CHECK_SWITCH + " " +
-                   		LogMessageDoc.GENERIC_ACTION)
-    protected List<OFStatistics> getSwitchStatistics(long switchId, 
+
+    @LogMessageDoc(level = "ERROR",
+            message = "Failure retrieving statistics from switch {switch}",
+            explanation = "An error occurred while retrieving statistics" +
+                    "from the switch",
+            recommendation = LogMessageDoc.CHECK_SWITCH + " " +
+                    LogMessageDoc.GENERIC_ACTION)
+    protected List<OFStatistics> getSwitchStatistics(long switchId,
                                                      OFStatisticsType statType) {
-        IFloodlightProviderService floodlightProvider = 
-                (IFloodlightProviderService)getContext().getAttributes().
-                    get(IFloodlightProviderService.class.getCanonicalName());
-        
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
+
         IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
         Future<List<OFStatistics>> future;
         List<OFStatistics> values = null;
@@ -87,7 +87,7 @@
                 specificReq.setMatch(match);
                 specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                 specificReq.setTableId((byte) 0xff);
-                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+                req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
                 requestLength += specificReq.getLength();
             } else if (statType == OFStatisticsType.AGGREGATE) {
                 OFAggregateStatisticsRequest specificReq = new OFAggregateStatisticsRequest();
@@ -96,23 +96,23 @@
                 specificReq.setMatch(match);
                 specificReq.setOutPort(OFPort.OFPP_NONE.getValue());
                 specificReq.setTableId((byte) 0xff);
-                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+                req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
                 requestLength += specificReq.getLength();
             } else if (statType == OFStatisticsType.PORT) {
                 OFPortStatisticsRequest specificReq = new OFPortStatisticsRequest();
-                specificReq.setPortNumber((short)OFPort.OFPP_NONE.getValue());
-                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+                specificReq.setPortNumber((short) OFPort.OFPP_NONE.getValue());
+                req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
                 requestLength += specificReq.getLength();
             } else if (statType == OFStatisticsType.QUEUE) {
                 OFQueueStatisticsRequest specificReq = new OFQueueStatisticsRequest();
-                specificReq.setPortNumber((short)OFPort.OFPP_ALL.getValue());
+                specificReq.setPortNumber((short) OFPort.OFPP_ALL.getValue());
                 // LOOK! openflowj does not define OFPQ_ALL! pulled this from openflow.h
                 // note that I haven't seen this work yet though...
                 specificReq.setQueueId(0xffffffff);
-                req.setStatistics(Collections.singletonList((OFStatistics)specificReq));
+                req.setStatistics(Collections.singletonList((OFStatistics) specificReq));
                 requestLength += specificReq.getLength();
             } else if (statType == OFStatisticsType.DESC ||
-                       statType == OFStatisticsType.TABLE) {
+                    statType == OFStatisticsType.TABLE) {
                 // pass - nothing todo besides set the type above
             }
             req.setLengthU(requestLength);
@@ -129,11 +129,11 @@
     protected List<OFStatistics> getSwitchStatistics(String switchId, OFStatisticsType statType) {
         return getSwitchStatistics(HexString.toLong(switchId), statType);
     }
-    
+
     protected OFFeaturesReply getSwitchFeaturesReply(long switchId) {
-        IFloodlightProviderService floodlightProvider = 
-                (IFloodlightProviderService)getContext().getAttributes().
-                get(IFloodlightProviderService.class.getCanonicalName());
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
 
         IOFSwitch sw = floodlightProvider.getSwitches().get(switchId);
         Future<OFFeaturesReply> future;
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
index f9eb877..d598005 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
@@ -17,29 +17,29 @@
 
     @Get("json")
     public Object getRole() {
-        IFloodlightProviderService floodlightProvider = 
-                (IFloodlightProviderService)getContext().getAttributes().
-                    get(IFloodlightProviderService.class.getCanonicalName());
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
 
         String switchId = (String) getRequestAttributes().get("switchId");
-        
+
         RoleInfo roleInfo;
-        
+
         if (switchId.equalsIgnoreCase("all")) {
-            HashMap<String,RoleInfo> model = new HashMap<String,RoleInfo>();
-            for (IOFSwitch sw: floodlightProvider.getSwitches().values()) {
-            	switchId = sw.getStringId();
-            	roleInfo = new RoleInfo(sw.getRole());
-            	model.put(switchId, roleInfo);
+            HashMap<String, RoleInfo> model = new HashMap<String, RoleInfo>();
+            for (IOFSwitch sw : floodlightProvider.getSwitches().values()) {
+                switchId = sw.getStringId();
+                roleInfo = new RoleInfo(sw.getRole());
+                model.put(switchId, roleInfo);
             }
             return model;
         }
-        
-    	Long dpid = HexString.toLong(switchId);
-    	IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
-    	if (sw == null)
-    		return null;
-    	roleInfo = new RoleInfo(sw.getRole());
-    	return roleInfo;
+
+        Long dpid = HexString.toLong(switchId);
+        IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
+        if (sw == null)
+            return null;
+        roleInfo = new RoleInfo(sw.getRole());
+        return roleInfo;
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
index a0cada7..468a50e 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web;
 
@@ -27,20 +27,21 @@
 
 /**
  * Return switch statistics information for specific switches
+ *
  * @author readams
  */
 public class SwitchStatisticsResource extends SwitchResourceBase {
-    protected final static Logger log = 
-        LoggerFactory.getLogger(SwitchStatisticsResource.class);
+    protected final static Logger log =
+            LoggerFactory.getLogger(SwitchStatisticsResource.class);
 
     @Get("json")
     public Map<String, Object> retrieve() {
-        HashMap<String,Object> result = new HashMap<String,Object>();
+        HashMap<String, Object> result = new HashMap<String, Object>();
         Object values = null;
-        
+
         String switchId = (String) getRequestAttributes().get("switchId");
         String statType = (String) getRequestAttributes().get("statType");
-        
+
         if (statType.equals("port")) {
             values = getSwitchStatistics(switchId, OFStatisticsType.PORT);
         } else if (statType.equals("queue")) {
diff --git a/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java b/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
index a125979..1ea4aa5 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SystemUptimeResource.java
@@ -6,27 +6,26 @@
 import org.restlet.resource.ServerResource;
 
 
-
 public class SystemUptimeResource extends ServerResource {
-	
-	public class UptimeRest {
-		long systemUptimeMsec;
 
-		public long getSystemUptimeMsec() {
-			return systemUptimeMsec;
-		}
-	}
-	
-	@Get("json")
-	public UptimeRest retrieve() {
-		IFloodlightProviderService floodlightProvider = 
-			(IFloodlightProviderService)getContext().getAttributes().
-			get(IFloodlightProviderService.class.getCanonicalName());
-		
-		UptimeRest uptime = new UptimeRest();
-		uptime.systemUptimeMsec = 
-		   System.currentTimeMillis() - floodlightProvider.getSystemStartTime();
-		
-		return (uptime);
-	}
+    public class UptimeRest {
+        long systemUptimeMsec;
+
+        public long getSystemUptimeMsec() {
+            return systemUptimeMsec;
+        }
+    }
+
+    @Get("json")
+    public UptimeRest retrieve() {
+        IFloodlightProviderService floodlightProvider =
+                (IFloodlightProviderService) getContext().getAttributes().
+                        get(IFloodlightProviderService.class.getCanonicalName());
+
+        UptimeRest uptime = new UptimeRest();
+        uptime.systemUptimeMsec =
+                System.currentTimeMillis() - floodlightProvider.getSystemStartTime();
+
+        return (uptime);
+    }
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
index 66c33f5..35f810b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011,2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011,2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web.serializers;
 
@@ -33,7 +33,7 @@
     @Override
     public void serialize(byte[] mac, JsonGenerator jGen,
                           SerializerProvider serializer)
-                                  throws IOException, JsonProcessingException {
+            throws IOException, JsonProcessingException {
         jGen.writeString(HexString.toHexString(mac));
     }
 
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
index e74cc01..304e835 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011,2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011,2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web.serializers;
 
@@ -33,7 +33,7 @@
     @Override
     public void serialize(Long dpid, JsonGenerator jGen,
                           SerializerProvider serializer)
-                                  throws IOException, JsonProcessingException {
+            throws IOException, JsonProcessingException {
         jGen.writeString(HexString.toHexString(dpid, 8));
     }
 
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
index 1bd7caf..d6bc9ba 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/IPv4Serializer.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011,2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011,2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web.serializers;
 
@@ -34,7 +34,7 @@
     @Override
     public void serialize(Integer i, JsonGenerator jGen,
                           SerializerProvider serializer)
-                                  throws IOException, JsonProcessingException {
+            throws IOException, JsonProcessingException {
         jGen.writeString(IPv4.fromIPv4Address(i));
     }
 
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
index a7c9fb7..eacf515 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011,2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011,2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web.serializers;
 
@@ -33,7 +33,7 @@
     @Override
     public void serialize(Long dpid, JsonGenerator jGen,
                           SerializerProvider serializer)
-                                  throws IOException, JsonProcessingException {
+            throws IOException, JsonProcessingException {
         jGen.writeString(HexString.toHexString(dpid, 6));
     }
 
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
index c125c76..0c4fa22 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/UShortSerializer.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011,2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011,2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.core.web.serializers;
 
@@ -32,7 +32,7 @@
     @Override
     public void serialize(Short s, JsonGenerator jGen,
                           SerializerProvider serializer) throws IOException,
-                                                  JsonProcessingException {
+            JsonProcessingException {
         if (s == null) jGen.writeNull();
         else jGen.writeNumber(s.shortValue() & 0xffff);
     }
diff --git a/src/main/java/net/floodlightcontroller/restserver/IRestApiService.java b/src/main/java/net/floodlightcontroller/restserver/IRestApiService.java
index d906795..ff8b3fc 100644
--- a/src/main/java/net/floodlightcontroller/restserver/IRestApiService.java
+++ b/src/main/java/net/floodlightcontroller/restserver/IRestApiService.java
@@ -5,6 +5,7 @@
 public interface IRestApiService extends IFloodlightService {
     /**
      * Adds a REST API
+     *
      * @param routeable
      */
     public void addRestletRoutable(RestletRoutable routable);
diff --git a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
index a51e499..031a239 100644
--- a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
+++ b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
@@ -31,25 +31,25 @@
 import org.slf4j.LoggerFactory;
 
 public class RestApiServer
-    implements IFloodlightModule, IRestApiService {
+        implements IFloodlightModule, IRestApiService {
     protected final static Logger logger = LoggerFactory.getLogger(RestApiServer.class);
     protected List<RestletRoutable> restlets;
     protected FloodlightModuleContext fmlContext;
     protected int restPort = 8080;
     protected String numThreads = null;
-    
+
     // ***********
     // Application
     // ***********
-    
+
     protected class RestApplication extends Application {
         protected Context context;
-        
+
         public RestApplication() {
             super(new Context());
             this.context = getContext();
         }
-        
+
         @Override
         public Restlet createInboundRoot() {
             Router baseRouter = new Router(context);
@@ -58,13 +58,12 @@
                 baseRouter.attach(rr.basePath(), rr.getRestlet(context));
             }
 
-            Filter slashFilter = new Filter() {            
+            Filter slashFilter = new Filter() {
                 @Override
                 protected int beforeHandle(Request request, Response response) {
                     Reference ref = request.getResourceRef();
                     String originalPath = ref.getPath();
-                    if (originalPath.contains("//"))
-                    {
+                    if (originalPath.contains("//")) {
                         String newPath = originalPath.replaceAll("/+", "/");
                         ref.setPath(newPath);
                     }
@@ -73,10 +72,10 @@
 
             };
             slashFilter.setNext(baseRouter);
-            
+
             return slashFilter;
         }
-        
+
         public void run(FloodlightModuleContext fmlContext, int restPort) {
             setStatusService(new StatusService() {
                 @Override
@@ -84,26 +83,26 @@
                                                         Request request,
                                                         Response response) {
                     return new JacksonRepresentation<Status>(status);
-                }                
+                }
             });
-            
+
             // Add everything in the module context to the rest
             for (Class<? extends IFloodlightService> s : fmlContext.getAllServices()) {
                 if (logger.isTraceEnabled()) {
                     logger.trace("Adding {} for service {} into context",
-                                 s.getCanonicalName(), fmlContext.getServiceImpl(s));
+                            s.getCanonicalName(), fmlContext.getServiceImpl(s));
                 }
-                context.getAttributes().put(s.getCanonicalName(), 
-                                            fmlContext.getServiceImpl(s));
+                context.getAttributes().put(s.getCanonicalName(),
+                        fmlContext.getServiceImpl(s));
             }
-            
+
             // Start listening for REST requests
             try {
                 final Component component = new Component();
                 Server server = component.getServers().add(Protocol.HTTP, restPort);
-                if (numThreads != null){
-                	logger.debug("Setting number of REST API threads to {}", numThreads);
-                	server.getContext().getParameters().add("defaultThreads", numThreads);
+                if (numThreads != null) {
+                    logger.debug("Setting number of REST API threads to {}", numThreads);
+                    server.getContext().getParameters().add("defaultThreads", numThreads);
                 }
                 component.getDefaultHost().attach(this);
                 component.start();
@@ -112,11 +111,11 @@
             }
         }
     }
-    
+
     // ***************
     // IRestApiService
     // ***************
-    
+
     @Override
     public void addRestletRoutable(RestletRoutable routable) {
         restlets.add(routable);
@@ -135,15 +134,15 @@
             }
             logger.debug(sb.toString());
         }
-        
+
         RestApplication restApp = new RestApplication();
         restApp.run(fmlContext, restPort);
     }
-    
+
     // *****************
     // IFloodlightModule
     // *****************
-    
+
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
         Collection<Class<? extends IFloodlightService>> services =
@@ -154,10 +153,10 @@
 
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService>
-            getServiceImpls() {
+    getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-        IFloodlightService> m = 
-            new HashMap<Class<? extends IFloodlightService>,
+                IFloodlightService> m =
+                new HashMap<Class<? extends IFloodlightService>,
                         IFloodlightService>();
         m.put(IRestApiService.class, this);
         return m;
@@ -176,7 +175,7 @@
         // startUp methods will be called
         this.restlets = new ArrayList<RestletRoutable>();
         this.fmlContext = context;
-        
+
         // read our config options
         Map<String, String> configOptions = context.getConfigParams(this);
         String port = configOptions.get("port");
@@ -184,10 +183,10 @@
             restPort = Integer.parseInt(port);
         }
         logger.debug("REST port set to {}", restPort);
-        
+
         String numThreads = configOptions.get("dispatcherthreads");
         if (numThreads != null) {
-        	this.numThreads = numThreads;
+            this.numThreads = numThreads;
         }
     }
 
diff --git a/src/main/java/net/floodlightcontroller/restserver/RestletRoutable.java b/src/main/java/net/floodlightcontroller/restserver/RestletRoutable.java
index cb7dfce..751a567 100644
--- a/src/main/java/net/floodlightcontroller/restserver/RestletRoutable.java
+++ b/src/main/java/net/floodlightcontroller/restserver/RestletRoutable.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.restserver;
 
@@ -22,18 +22,21 @@
 
 /**
  * Register a set of REST resources with the central controller
+ *
  * @author readams
  */
 public interface RestletRoutable {
     /**
      * Get the restlet that will map to the resources
+     *
      * @param context the context for constructing the restlet
      * @return the restlet
      */
     Restlet getRestlet(Context context);
-    
+
     /**
      * Get the base path URL where the router should be registered
+     *
      * @return the base path URL where the router should be registered
      */
     String basePath();
diff --git a/src/main/java/net/floodlightcontroller/threadpool/IThreadPoolService.java b/src/main/java/net/floodlightcontroller/threadpool/IThreadPoolService.java
index a537a3a..f9460cb 100644
--- a/src/main/java/net/floodlightcontroller/threadpool/IThreadPoolService.java
+++ b/src/main/java/net/floodlightcontroller/threadpool/IThreadPoolService.java
@@ -9,6 +9,7 @@
      * Get the master scheduled thread pool executor maintained by the
      * ThreadPool provider.  This can be used by other modules as a centralized
      * way to schedule tasks.
+     *
      * @return
      */
     public ScheduledExecutorService getScheduledExecutor();
diff --git a/src/main/java/net/floodlightcontroller/threadpool/ThreadPool.java b/src/main/java/net/floodlightcontroller/threadpool/ThreadPool.java
index aa426a7..6314a77 100644
--- a/src/main/java/net/floodlightcontroller/threadpool/ThreadPool.java
+++ b/src/main/java/net/floodlightcontroller/threadpool/ThreadPool.java
@@ -14,19 +14,19 @@
 
 public class ThreadPool implements IThreadPoolService, IFloodlightModule {
     protected ScheduledExecutorService executor = null;
-    
+
     // IThreadPoolService
 
     @Override
     public ScheduledExecutorService getScheduledExecutor() {
         return executor;
     }
-    
+
     // IFloodlightModule
-    
+
     @Override
     public Collection<Class<? extends IFloodlightService>> getModuleServices() {
-        Collection<Class<? extends IFloodlightService>> l = 
+        Collection<Class<? extends IFloodlightService>> l =
                 new ArrayList<Class<? extends IFloodlightService>>();
         l.add(IThreadPoolService.class);
         return l;
@@ -34,11 +34,11 @@
 
     @Override
     public Map<Class<? extends IFloodlightService>, IFloodlightService>
-            getServiceImpls() {
+    getServiceImpls() {
         Map<Class<? extends IFloodlightService>,
-            IFloodlightService> m = 
+                IFloodlightService> m =
                 new HashMap<Class<? extends IFloodlightService>,
-                    IFloodlightService>();
+                        IFloodlightService>();
         m.put(IThreadPoolService.class, this);
         // We are the class that implements the service
         return m;
@@ -46,14 +46,14 @@
 
     @Override
     public Collection<Class<? extends IFloodlightService>>
-            getModuleDependencies() {
+    getModuleDependencies() {
         // No dependencies
         return null;
     }
 
     @Override
     public void init(FloodlightModuleContext context)
-                                 throws FloodlightModuleException {
+            throws FloodlightModuleException {
         executor = Executors.newScheduledThreadPool(15);
     }
 
diff --git a/src/main/java/net/floodlightcontroller/util/BundleAction.java b/src/main/java/net/floodlightcontroller/util/BundleAction.java
index 0d82275..ea797a8 100644
--- a/src/main/java/net/floodlightcontroller/util/BundleAction.java
+++ b/src/main/java/net/floodlightcontroller/util/BundleAction.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -22,7 +22,6 @@
 import java.util.List;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public enum BundleAction {
@@ -33,16 +32,16 @@
 
     public static List<BundleAction> getAvailableActions(BundleState state) {
         List<BundleAction> actions = new ArrayList<BundleAction>();
-        if (Arrays.binarySearch(new BundleState[] {
+        if (Arrays.binarySearch(new BundleState[]{
                 BundleState.ACTIVE, BundleState.STARTING,
-                BundleState.UNINSTALLED }, state) < 0) {
+                BundleState.UNINSTALLED}, state) < 0) {
             actions.add(START);
         }
-        if (Arrays.binarySearch(new BundleState[] {
+        if (Arrays.binarySearch(new BundleState[]{
                 BundleState.ACTIVE}, state) >= 0) {
             actions.add(STOP);
         }
-        if (Arrays.binarySearch(new BundleState[] {
+        if (Arrays.binarySearch(new BundleState[]{
                 BundleState.UNINSTALLED}, state) < 0) {
             actions.add(UNINSTALL);
         }
diff --git a/src/main/java/net/floodlightcontroller/util/BundleState.java b/src/main/java/net/floodlightcontroller/util/BundleState.java
index f89bc0b..ef32958 100644
--- a/src/main/java/net/floodlightcontroller/util/BundleState.java
+++ b/src/main/java/net/floodlightcontroller/util/BundleState.java
@@ -1,33 +1,32 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
 /**
- *
  * @author David Erickson (daviderickson@cs.stanford.edu)
  */
 public enum BundleState {
-    ACTIVE              (32),
-    INSTALLED           (2),
-    RESOLVED            (4),
-    STARTING            (8),
-    STOPPING            (16),
-    UNINSTALLED         (1);
+    ACTIVE(32),
+    INSTALLED(2),
+    RESOLVED(4),
+    STARTING(8),
+    STOPPING(16),
+    UNINSTALLED(1);
 
     protected int value;
 
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistory.java b/src/main/java/net/floodlightcontroller/util/EventHistory.java
index 69031ba..40c9a36 100644
--- a/src/main/java/net/floodlightcontroller/util/EventHistory.java
+++ b/src/main/java/net/floodlightcontroller/util/EventHistory.java
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package net.floodlightcontroller.util;
 
@@ -7,30 +7,33 @@
 
 /**
  * @author subrata
- *
  */
 
 public class EventHistory<T> {
     public static final int EV_HISTORY_DEFAULT_SIZE = 1024;
 
-    public String  description;
-    public int     event_history_size;
-    public int     current_index;
+    public String description;
+    public int event_history_size;
+    public int current_index;
     public boolean full; // true if all are in use
     public ArrayList<Event> events;
 
     public String getDescription() {
         return description;
     }
+
     public int getEvent_history_size() {
         return event_history_size;
     }
+
     public int getCurrent_index() {
         return current_index;
     }
+
     public boolean isFull() {
         return full;
     }
+
     public ArrayList<Event> getEvents() {
         return events;
     }
@@ -69,18 +72,18 @@
         events = new ArrayList<Event>(maxEvents);
 
         for (int idx = 0; idx < maxEvents; idx++) {
-            Event evH     = new Event();
+            Event evH = new Event();
             evH.base_info = new EventHistoryBaseInfo();
-            evH.info      = null;
+            evH.info = null;
             evH.base_info.state = EvState.FREE;
-            evH.base_info.idx   = idx;
+            evH.base_info.idx = idx;
             events.add(idx, evH);
         }
 
         description = "Event-History:" + desc;
-        event_history_size   = maxEvents;
-        current_index        = 0;
-        full                 = false;
+        event_history_size = maxEvents;
+        current_index = 0;
+        full = false;
     }
 
     // Constructor for default size
@@ -95,11 +98,11 @@
             description = "No event found";
             return;
         }
-        int curSize = (eventHist.full)?eventHist.event_history_size:
-                                                    eventHist.current_index;
-        int size  = (latestK < curSize)?latestK:curSize;
+        int curSize = (eventHist.full) ? eventHist.event_history_size :
+                eventHist.current_index;
+        int size = (latestK < curSize) ? latestK : curSize;
         int evIdx = eventHist.current_index;
-        int topSz = (evIdx >= size)?size:evIdx;
+        int topSz = (evIdx >= size) ? size : evIdx;
 
         // Need to create a new one since size is different
         events = new ArrayList<Event>(size);
@@ -107,7 +110,7 @@
         // Get the top part
         int origIdx = evIdx;
         for (int idx = 0; idx < topSz; idx++) {
-            Event evH         = eventHist.events.get(--origIdx);
+            Event evH = eventHist.events.get(--origIdx);
             evH.base_info.idx = idx;
             events.add(idx, evH);
         }
@@ -121,9 +124,9 @@
         }
 
         description = eventHist.description;
-        event_history_size   = size;
-        current_index        = 0; // since it is full
-        full                 = true;
+        event_history_size = size;
+        current_index = 0; // since it is full
+        full = true;
     }
 
     // Get an index for writing a new event. This method is synchronized for
@@ -131,13 +134,13 @@
     // by the caller event at the index is updated without any lock
     public synchronized int NextIdx() {
         // curIdx should be in the 0 to evArraySz-1
-        if (current_index == (event_history_size-1)) {
+        if (current_index == (event_history_size - 1)) {
             current_index = 0;
             full = true;
-            return (event_history_size-1);
+            return (event_history_size - 1);
         } else {
             current_index++;
-            return (current_index-1);
+            return (current_index - 1);
         }
     }
 
@@ -148,6 +151,7 @@
      * and the current object at that array location is returned to the
      * calling process so that the calling process can use that object
      * for the next event of the same type
+     *
      * @param t
      * @param op
      * @return
@@ -165,7 +169,7 @@
         return temp;
     }
 
-    /***
+    /**
      * Clear the event history, needs to be done under lock
      */
     public void clear() {
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java
index 74fc973..52b623d 100644
--- a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java
+++ b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfo.java
@@ -3,23 +3,26 @@
 
 import org.codehaus.jackson.map.annotate.JsonSerialize;
 
-@JsonSerialize(using=EventHistoryBaseInfoJSONSerializer.class)
+@JsonSerialize(using = EventHistoryBaseInfoJSONSerializer.class)
 public class EventHistoryBaseInfo {
-    public int              idx;
-    public long             time_ms; // timestamp in milliseconds
-    public EventHistory.EvState          state;
-    public EventHistory.EvAction         action;
+    public int idx;
+    public long time_ms; // timestamp in milliseconds
+    public EventHistory.EvState state;
+    public EventHistory.EvAction action;
 
     // Getters
     public int getIdx() {
         return idx;
     }
+
     public long getTime_ms() {
         return time_ms;
     }
+
     public EventHistory.EvState getState() {
         return state;
     }
+
     public EventHistory.EvAction getAction() {
         return action;
     }
diff --git a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java
index 3916282..0fe4b17 100644
--- a/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java
+++ b/src/main/java/net/floodlightcontroller/util/EventHistoryBaseInfoJSONSerializer.java
@@ -1,18 +1,18 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -27,32 +27,31 @@
 
 /**
  * @author subrata
- *
  */
 
-public class EventHistoryBaseInfoJSONSerializer extends 
-                                    JsonSerializer<EventHistoryBaseInfo> {
+public class EventHistoryBaseInfoJSONSerializer extends
+        JsonSerializer<EventHistoryBaseInfo> {
 
- 
+
     /**
      * Performs the serialization of a EventHistory.BaseInfo object
      */
     @Override
     public void serialize(EventHistoryBaseInfo base_info, JsonGenerator jGen,
-                    SerializerProvider serializer) 
-                    throws IOException, JsonProcessingException {
+                          SerializerProvider serializer)
+            throws IOException, JsonProcessingException {
         jGen.writeStartObject();
-        jGen.writeNumberField("Idx",    base_info.getIdx());
+        jGen.writeNumberField("Idx", base_info.getIdx());
         Timestamp ts = new Timestamp(base_info.getTime_ms());
         String tsStr = ts.toString();
         while (tsStr.length() < 23) {
             tsStr = tsStr.concat("0");
         }
         jGen.writeStringField("Time", tsStr);
-        jGen.writeStringField("State",  base_info.getState().name());
+        jGen.writeStringField("State", base_info.getState().name());
         String acStr = base_info.getAction().name().toLowerCase();
         // Capitalize the first letter
-        acStr = acStr.substring(0,1).toUpperCase().concat(acStr.substring(1));
+        acStr = acStr.substring(0, 1).toUpperCase().concat(acStr.substring(1));
         jGen.writeStringField("Action", acStr);
         jGen.writeEndObject();
     }
diff --git a/src/main/java/net/floodlightcontroller/util/FilterIterator.java b/src/main/java/net/floodlightcontroller/util/FilterIterator.java
index 47cd5c9..fac4e7a 100644
--- a/src/main/java/net/floodlightcontroller/util/FilterIterator.java
+++ b/src/main/java/net/floodlightcontroller/util/FilterIterator.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -30,6 +30,7 @@
 
     /**
      * Construct a filter iterator from the given sub iterator
+     *
      * @param subIterator the sub iterator over which we'll filter
      */
     public FilterIterator(Iterator<T> subIterator) {
@@ -40,11 +41,12 @@
     /**
      * Check whether the given value should be returned by the
      * filter
+     *
      * @param value the value to check
      * @return true if the value should be included
      */
     protected abstract boolean matches(T value);
-    
+
     // ***********
     // Iterator<T>
     // ***********
@@ -52,7 +54,7 @@
     @Override
     public boolean hasNext() {
         if (next != null) return true;
-        
+
         while (subIterator.hasNext()) {
             next = subIterator.next();
             if (matches(next))
diff --git a/src/main/java/net/floodlightcontroller/util/IterableIterator.java b/src/main/java/net/floodlightcontroller/util/IterableIterator.java
index 584de08..b71404a 100644
--- a/src/main/java/net/floodlightcontroller/util/IterableIterator.java
+++ b/src/main/java/net/floodlightcontroller/util/IterableIterator.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -28,7 +28,7 @@
 public class IterableIterator<T> implements Iterator<T> {
     Iterator<? extends Iterable<T>> subIterator;
     Iterator<T> current = null;
-    
+
     public IterableIterator(Iterator<? extends Iterable<T>> subIterator) {
         super();
         this.subIterator = subIterator;
@@ -46,7 +46,7 @@
         while (!current.hasNext() && subIterator.hasNext()) {
             current = subIterator.next().iterator();
         }
-        
+
         return current.hasNext();
     }
 
diff --git a/src/main/java/net/floodlightcontroller/util/LRUHashMap.java b/src/main/java/net/floodlightcontroller/util/LRUHashMap.java
index 477e886..7b8d536 100644
--- a/src/main/java/net/floodlightcontroller/util/LRUHashMap.java
+++ b/src/main/java/net/floodlightcontroller/util/LRUHashMap.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -21,18 +21,18 @@
 import java.util.Map;
 
 public class LRUHashMap<K, V> extends LinkedHashMap<K, V> {
-    
+
     private static final long serialVersionUID = 1L;
-    
+
     private final int capacity;
-    public LRUHashMap(int capacity)
-    {
-        super(capacity+1, 0.75f, true);
+
+    public LRUHashMap(int capacity) {
+        super(capacity + 1, 0.75f, true);
         this.capacity = capacity;
     }
-    
-    protected boolean removeEldestEntry(Map.Entry<K,V> eldest) {
-       return size() > capacity;
+
+    protected boolean removeEldestEntry(Map.Entry<K, V> eldest) {
+        return size() > capacity;
     }
 
 }
diff --git a/src/main/java/net/floodlightcontroller/util/MACAddress.java b/src/main/java/net/floodlightcontroller/util/MACAddress.java
index 13d83d1..f3ac52b 100644
--- a/src/main/java/net/floodlightcontroller/util/MACAddress.java
+++ b/src/main/java/net/floodlightcontroller/util/MACAddress.java
@@ -15,9 +15,9 @@
  *
  * @author Sho Shimizu (sho.shimizu@gmail.com)
  */
-@JsonDeserialize(using=MACAddressDeserializer.class)
-@JsonSerialize(using=MACAddressSerializer.class)
-public class MACAddress implements Serializable{
+@JsonDeserialize(using = MACAddressDeserializer.class)
+@JsonSerialize(using = MACAddressSerializer.class)
+public class MACAddress implements Serializable {
     private static final long serialVersionUID = 10000L;
     public static final int MAC_ADDRESS_LENGTH = 6;
     private byte[] address = new byte[MAC_ADDRESS_LENGTH];
@@ -26,7 +26,7 @@
      * Default constructor.
      */
     public MACAddress() {
-	this.address = new byte[] { 0, 0, 0, 0, 0, 0};
+        this.address = new byte[]{0, 0, 0, 0, 0, 0};
     }
 
     /**
@@ -40,6 +40,7 @@
 
     /**
      * Returns a MAC address instance representing the value of the specified {@code String}.
+     *
      * @param address the String representation of the MAC Address to be parsed.
      * @return a MAC Address instance representing the value of the specified {@code String}.
      * @throws IllegalArgumentException if the string cannot be parsed as a MAC address.
@@ -49,13 +50,13 @@
         if (elements.length != MAC_ADDRESS_LENGTH) {
             throw new IllegalArgumentException(
                     "Specified MAC Address must contain 12 hex digits" +
-                    " separated pairwise by :'s.");
+                            " separated pairwise by :'s.");
         }
 
         byte[] addressInBytes = new byte[MAC_ADDRESS_LENGTH];
         for (int i = 0; i < MAC_ADDRESS_LENGTH; i++) {
             String element = elements[i];
-            addressInBytes[i] = (byte)Integer.parseInt(element, 16);
+            addressInBytes[i] = (byte) Integer.parseInt(element, 16);
         }
 
         return new MACAddress(addressInBytes);
@@ -63,6 +64,7 @@
 
     /**
      * Returns a MAC address instance representing the specified {@code byte} array.
+     *
      * @param address the byte array to be parsed.
      * @return a MAC address instance representing the specified {@code byte} array.
      * @throws IllegalArgumentException if the byte array cannot be parsed as a MAC address.
@@ -78,18 +80,19 @@
     /**
      * Returns a MAC address instance representing the specified {@code long} value.
      * The lower 48 bits of the long value are used to parse as a MAC address.
+     *
      * @param address the long value to be parsed. The lower 48 bits are used for a MAC address.
      * @return a MAC address instance representing the specified {@code long} value.
      * @throws IllegalArgumentException if the long value cannot be parsed as a MAC address.
      */
     public static MACAddress valueOf(long address) {
-        byte[] addressInBytes = new byte[] {
-                (byte)((address >> 40) & 0xff),
-                (byte)((address >> 32) & 0xff),
-                (byte)((address >> 24) & 0xff),
-                (byte)((address >> 16) & 0xff),
-                (byte)((address >> 8 ) & 0xff),
-                (byte)((address >> 0) & 0xff)
+        byte[] addressInBytes = new byte[]{
+                (byte) ((address >> 40) & 0xff),
+                (byte) ((address >> 32) & 0xff),
+                (byte) ((address >> 24) & 0xff),
+                (byte) ((address >> 16) & 0xff),
+                (byte) ((address >> 8) & 0xff),
+                (byte) ((address >> 0) & 0xff)
         };
 
         return new MACAddress(addressInBytes);
@@ -97,6 +100,7 @@
 
     /**
      * Returns the length of the {@code MACAddress}.
+     *
      * @return the length of the {@code MACAddress}.
      */
     public int length() {
@@ -105,6 +109,7 @@
 
     /**
      * Returns the value of the {@code MACAddress} as a {@code byte} array.
+     *
      * @return the numeric value represented by this object after conversion to type {@code byte} array.
      */
     public byte[] toBytes() {
@@ -113,6 +118,7 @@
 
     /**
      * Returns the value of the {@code MACAddress} as a {@code long}.
+     *
      * @return the numeric value represented by this object after conversion to type {@code long}.
      */
     public long toLong() {
@@ -126,6 +132,7 @@
 
     /**
      * Returns {@code true} if the MAC address is the broadcast address.
+     *
      * @return {@code true} if the MAC address is the broadcast address.
      */
     public boolean isBroadcast() {
@@ -138,6 +145,7 @@
 
     /**
      * Returns {@code true} if the MAC address is the multicast address.
+     *
      * @return {@code true} if the MAC address is the multicast address.
      */
     public boolean isMulticast() {
@@ -157,7 +165,7 @@
             return false;
         }
 
-        MACAddress other = (MACAddress)o;
+        MACAddress other = (MACAddress) o;
         return Arrays.equals(this.address, other.address);
     }
 
@@ -168,6 +176,6 @@
 
     @Override
     public String toString() {
-    	return HexString.toHexString(address);
+        return HexString.toHexString(address);
     }
 }
diff --git a/src/main/java/net/floodlightcontroller/util/MultiIterator.java b/src/main/java/net/floodlightcontroller/util/MultiIterator.java
index bcbc916..347ff10 100644
--- a/src/main/java/net/floodlightcontroller/util/MultiIterator.java
+++ b/src/main/java/net/floodlightcontroller/util/MultiIterator.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2012 Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2012 Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -28,7 +28,7 @@
 public class MultiIterator<T> implements Iterator<T> {
     Iterator<Iterator<T>> subIterator;
     Iterator<T> current = null;
-    
+
     public MultiIterator(Iterator<Iterator<T>> subIterator) {
         super();
         this.subIterator = subIterator;
@@ -46,7 +46,7 @@
         while (!current.hasNext() && subIterator.hasNext()) {
             current = subIterator.next();
         }
-        
+
         return current.hasNext();
     }
 
diff --git a/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java b/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java
index 4dfb60b..47a92a9 100644
--- a/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java
+++ b/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java
@@ -15,35 +15,37 @@
 import org.openflow.protocol.OFType;
 
 /**
- * Dampens OFMessages sent to an OF switch. A message is only written to 
+ * Dampens OFMessages sent to an OF switch. A message is only written to
  * a switch if the same message (as defined by .equals()) has not been written
  * in the last n milliseconds. Timer granularity is based on TimedCache
- * @author gregor
  *
+ * @author gregor
  */
 public class OFMessageDamper {
     /**
      * An entry in the TimedCache. A cache entry consists of the sent message
-     * as well as the switch to which the message was sent. 
-     * 
-     * NOTE: We currently use the full OFMessage object. To save space, we 
-     * could use a cryptographic hash (e.g., SHA-1). However, this would 
-     * obviously be more time-consuming.... 
-     * 
+     * as well as the switch to which the message was sent.
+     * <p/>
+     * NOTE: We currently use the full OFMessage object. To save space, we
+     * could use a cryptographic hash (e.g., SHA-1). However, this would
+     * obviously be more time-consuming....
+     * <p/>
      * We also store a reference to the actual IOFSwitch object and /not/
      * the switch DPID. This way we are guarnteed to not dampen messages if
      * a switch disconnects and then reconnects.
-     * 
+     *
      * @author gregor
      */
     protected static class DamperEntry {
         OFMessage msg;
         IOFSwitch sw;
+
         public DamperEntry(OFMessage msg, IOFSwitch sw) {
             super();
             this.msg = msg;
             this.sw = sw;
         }
+
         /* (non-Javadoc)
          * @see java.lang.Object#hashCode()
          */
@@ -55,6 +57,7 @@
             result = prime * result + ((sw == null) ? 0 : sw.hashCode());
             return result;
         }
+
         /* (non-Javadoc)
          * @see java.lang.Object#equals(java.lang.Object)
          */
@@ -72,67 +75,70 @@
             } else if (!sw.equals(other.sw)) return false;
             return true;
         }
-        
-      
+
+
     }
+
     TimedCache<DamperEntry> cache;
     EnumSet<OFType> msgTypesToCache;
+
     /**
-     * 
-     * @param capacity the maximum number of messages that should be 
-     * kept
-     * @param typesToDampen The set of OFMessageTypes that should be 
-     * dampened by this instance. Other types will be passed through
-     * @param timeout The dampening timeout. A message will only be
-     * written if the last write for the an equal message more than
-     * timeout ms ago. 
+     * @param capacity      the maximum number of messages that should be
+     *                      kept
+     * @param typesToDampen The set of OFMessageTypes that should be
+     *                      dampened by this instance. Other types will be passed through
+     * @param timeout       The dampening timeout. A message will only be
+     *                      written if the last write for the an equal message more than
+     *                      timeout ms ago.
      */
-    public OFMessageDamper(int capacity, 
-                           Set<OFType> typesToDampen,  
+    public OFMessageDamper(int capacity,
+                           Set<OFType> typesToDampen,
                            int timeout) {
         cache = new TimedCache<DamperEntry>(capacity, timeout);
         msgTypesToCache = EnumSet.copyOf(typesToDampen);
-    }        
-    
+    }
+
     /**
      * write the messag to the switch according to our dampening settings
+     *
      * @param sw
      * @param msg
      * @param cntx
      * @return true if the message was written to the switch, false if
-     * the message was dampened. 
+     * the message was dampened.
      * @throws IOException
      */
     public boolean write(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
-                    throws IOException {
+            throws IOException {
         return write(sw, msg, cntx, false);
     }
-    
+
     /**
      * write the messag to the switch according to our dampening settings
+     *
      * @param sw
      * @param msg
      * @param cntx
      * @param flush true to flush the packet immidiately
      * @return true if the message was written to the switch, false if
-     * the message was dampened. 
+     * the message was dampened.
      * @throws IOException
      */
     public boolean write(IOFSwitch sw, OFMessage msg,
-                        FloodlightContext cntx, boolean flush) 
+                         FloodlightContext cntx, boolean flush)
             throws IOException {
-        if (! msgTypesToCache.contains(msg.getType())) {
+        if (!msgTypesToCache.contains(msg.getType())) {
             sw.write(msg, cntx);
             if (flush) {
                 sw.flush();
             }
             return true;
         }
-        
+
         DamperEntry entry = new DamperEntry(msg, sw);
         if (cache.update(entry)) {
             // entry exists in cache. Dampening.
-            return false; 
+            return false;
         } else {
             sw.write(msg, cntx);
             if (flush) {
diff --git a/src/main/java/net/floodlightcontroller/util/TimedCache.java b/src/main/java/net/floodlightcontroller/util/TimedCache.java
index 3a44556..2a90f0b 100644
--- a/src/main/java/net/floodlightcontroller/util/TimedCache.java
+++ b/src/main/java/net/floodlightcontroller/util/TimedCache.java
@@ -1,19 +1,19 @@
 /**
-*    Copyright 2011, Big Switch Networks, Inc. 
-*    Originally created by David Erickson, Stanford University
-* 
-*    Licensed 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.
-**/
+ *    Copyright 2011, Big Switch Networks, Inc.
+ *    Originally created by David Erickson, Stanford University
+ *
+ *    Licensed 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.
+ **/
 
 package net.floodlightcontroller.util;
 
@@ -26,55 +26,53 @@
  * The value is time-stamp in milliseconds
  * The time interval denotes the interval for which the entry should remain in the hashmap.
  * If an entry is present in the Linkedhashmap, it does not mean that it's valid (recently seen)
- * 
+ *
  * @param <K> Type of the values in this cache
  */
-public class TimedCache<K> {    
+public class TimedCache<K> {
     private final long timeoutInterval;    //specified in milliseconds.
-	private ConcurrentMap<K, Long> cache;
-    
+    private ConcurrentMap<K, Long> cache;
+
     /**
-     * 
-     * @param capacity the maximum number of entries in the cache before the 
-     * oldest entry is evicted. 
+     * @param capacity   the maximum number of entries in the cache before the
+     *                   oldest entry is evicted.
      * @param timeToLive specified in milliseconds
      */
-	public TimedCache(int capacity, int timeToLive) {
+    public TimedCache(int capacity, int timeToLive) {
         cache = new ConcurrentLinkedHashMap.Builder<K, Long>()
-        	    .maximumWeightedCapacity(capacity)
-            .build();
+                .maximumWeightedCapacity(capacity)
+                .build();
         this.timeoutInterval = timeToLive;
     }
-    
+
     public long getTimeoutInterval() {
         return this.timeoutInterval;
     }
-    
+
     /**
      * Always try to update the cache and set the last-seen value for this key.
-     * 
+     * <p/>
      * Return true, if a valid existing field was updated, else return false.
      * (note: if multiple threads update simultaneously, one of them will succeed,
-     *  other wills return false)
-     * 
+     * other wills return false)
+     *
      * @param key
      * @return boolean
      */
-    public boolean update(K key)
-    {
+    public boolean update(K key) {
         Long curr = new Long(System.currentTimeMillis());
         Long prev = cache.putIfAbsent(key, curr);
-        
+
         if (prev == null) {
-        		return false;
+            return false;
         }
 
         if (curr - prev > this.timeoutInterval) {
             if (cache.replace(key, prev, curr)) {
-            		return false;
+                return false;
             }
         }
-        
+
         return true;
     }
 }