Added FlowSync flag to FlowProgrammer.
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java
index 87a4767..a59a9f9 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowProgrammer.java
@@ -11,6 +11,8 @@
 import net.floodlightcontroller.core.module.IFloodlightService;
 
 public class FlowProgrammer implements IFloodlightModule {
+	private static final boolean enableFlowSync = false;
+	
     protected volatile IFloodlightProviderService floodlightProvider;
 
     protected FlowPusher pusher;
@@ -20,7 +22,9 @@
         
     public FlowProgrammer() {
 	pusher = new FlowPusher(NUM_PUSHER_THREAD);
+	if (enableFlowSync) {
 	synchronizer = new FlowSynchronizer();
+	}
     }
     
     @Override
@@ -28,13 +32,17 @@
 	    throws FloodlightModuleException {
 	floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
 	pusher.init(null, floodlightProvider.getOFMessageFactory(), null);
+	if (enableFlowSync) {
 	synchronizer.init(context);
+	}
     }
 
     @Override
     public void startUp(FloodlightModuleContext context) {
 	pusher.start();
+	if (enableFlowSync) {
 	synchronizer.startUp(context);
+	}
     }
 
     @Override
@@ -42,7 +50,9 @@
 	Collection<Class<? extends IFloodlightService>> l = 
 		new ArrayList<Class<? extends IFloodlightService>>();
 	l.add(IFlowPusherService.class);
+	if (enableFlowSync) {
 	l.add(IFlowSyncService.class);
+	}
 	return l;
     }
 
@@ -53,7 +63,9 @@
 	    new HashMap<Class<? extends IFloodlightService>,
 	    IFloodlightService>();
 	m.put(IFlowPusherService.class, pusher);
-	m.put(IFlowSyncService.class, synchronizer);	
+	if (enableFlowSync) {
+	m.put(IFlowSyncService.class, synchronizer);
+	}
 	return m;
     }
 
diff --git a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
index e87f631..532477a 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/flowprogrammer/FlowPusher.java
@@ -33,8 +33,8 @@
 import net.onrc.onos.ofcontroller.util.Port;
 
 /**
- * FlowPusher intermediates flow_mod sent from FlowManager/FlowSync to switches.
- * FlowPusher controls the rate of sending flow_mods so that connection doesn't overflow.
+ * FlowPusher intermediates FlowManager/FlowSynchronizer and switches to push OpenFlow
+ * messages to switches in proper rate.
  * @author Naoki Shiota
  *
  */
@@ -64,6 +64,7 @@
 		SUSPENDED,
 	}
 	
+	@SuppressWarnings("serial")
 	private class SwitchQueue extends ArrayDeque<OFMessage> {
 		QueueState state;
 		
@@ -107,6 +108,11 @@
 	
 	private int number_thread = 1;
 	
+	/**
+	 * Main thread that reads messages from queues and sends them to switches.
+	 * @author Naoki Shiota
+	 *
+	 */
 	private class FlowPusherProcess implements Runnable {
 		private Map<IOFSwitch,SwitchQueue> queues
 		= new HashMap<IOFSwitch,SwitchQueue>();
@@ -233,7 +239,7 @@
 	}
 	
 	/**
-	 * Suspend processing a queue related to given switch.
+	 * Suspend sending messages to switch.
 	 * @param sw
 	 */
 	@Override
@@ -254,7 +260,7 @@
 	}
 
 	/**
-	 * Resume processing a queue related to given switch.
+	 * Resume sending messages to switch.
 	 */
 	@Override
 	public boolean resume(IOFSwitch sw) {
@@ -273,6 +279,9 @@
 		}
 	}
 	
+	/**
+	 * Check if given switch is suspended.
+	 */
 	@Override
 	public boolean isSuspended(IOFSwitch sw) {
 		SwitchQueue queue = getQueue(sw);
@@ -286,7 +295,7 @@
 	}
 
 	/**
-	 * End processing queue and exit thread.
+	 * Stop processing queue and exit thread.
 	 */
 	public void stop() {
 		if (threadMap == null) {
@@ -300,6 +309,11 @@
 		}
 	}
 	
+	/**
+	 * Set sending rate to a switch.
+	 * @param sw Switch.
+	 * @param rate Rate in bytes/sec.
+	 */
 	public void setRate(IOFSwitch sw, long rate) {
 		SwitchQueue queue = getQueue(sw);
 		if (queue == null) {
@@ -313,8 +327,9 @@
 	
 	/**
 	 * Add OFMessage to the queue related to given switch.
-	 * @param sw
-	 * @param msg
+	 * @param sw Switch to which message is sent.
+	 * @param msg Message to be sent.
+	 * @return true if succeed.
 	 */
 	@Override
 	public boolean add(IOFSwitch sw, OFMessage msg) {
@@ -341,10 +356,10 @@
 	
 	/**
 	 * Create OFMessage from given flow information and add it to the queue.
-	 * @param sw
-	 * @param flowObj
-	 * @param flowEntryObj
-	 * @return
+	 * @param sw Switch to which message is sent.
+	 * @param flowObj FlowPath.
+	 * @param flowEntryObj FlowEntry.
+	 * @return true if succeed.
 	 */
 	@Override
 	public boolean add(IOFSwitch sw, IFlowPath flowObj, IFlowEntry flowEntryObj) {
@@ -651,6 +666,13 @@
 		return true;
 	}
 	
+	/**
+	 * Create OFMessage from given flow information and add it to the queue.
+	 * @param sw Switch to which message is sent.
+	 * @param flowPath FlowPath.
+	 * @param flowEntry FlowEntry.
+	 * @return true if secceed.
+	 */
 	@Override
 	public boolean add(IOFSwitch sw, FlowPath flowPath, FlowEntry flowEntry) {
 		//