Fix checkstyle whitespace issues - WHITESPACE ONLY
Change-Id: Ic205c1afd639c6008d61d9de95cb764eeb6238ca
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);