package org.opendaylight.controller.clustering.services_implementation.internal;
import java.util.Map;
+
import org.opendaylight.controller.clustering.services.ICacheUpdateAware;
import org.opendaylight.controller.clustering.services.IClusterGlobalServices;
import org.slf4j.Logger;
@Override
void setCacheUpdateAware(Map props, ICacheUpdateAware s) {
- logger.trace("setCacheUpdateAware");
+ logger.trace("setCacheUpdateAware: {}",s);
if (props.get("containerName") != null) {
// If we got a reference with the containerName property
// that is not what we are looking for, so filter it out.
@Override
void unsetCacheUpdateAware(Map props, ICacheUpdateAware s) {
- logger.trace("unsetCacheUpdateAware");
+ logger.trace("unsetCacheUpdateAware: {}",s);
if (props.get("containerName") != null) {
// If we got a reference with the containerName property
// that is not what we are looking for, so filter it out.
* export the interface ICoordinatorChangeAware
*/
class ListenCoordinatorChange implements IListenRoleChange {
+ @Override
public void newActiveAvailable() {
if (coordinatorChangeAware != null) {
// Make sure to look the set while walking it
logger.trace("cachenames provided below:");
for (String cache : caches) {
if (this.cacheUpdateAware.get(cache) != null) {
- logger.error("cachename:{} on container:{} has " +
- "already a listener", cache,
- this.containerName);
+ logger.error("cachename:{} on container:{} has already a listener", cache, this.containerName);
} else {
- GetUpdatesContainer<?, ?> up =
- new GetUpdatesContainer(s, this.containerName,
- cache);
+ GetUpdatesContainer<?, ?> up = new GetUpdatesContainer(s, this.containerName, cache);
if (up != null) {
try {
this.clusterService.addListener(this.containerName,
"been registered", cache,
this.containerName);
} catch (CacheListenerAddException exc) {
+ logger.debug("Cache {} didn't exist when {} tried to register to its updates", cache, s);
// Do nothing, the important is that
// we don't register the listener in
// the shadow, and we are not doing
}
public void started() {
- String schemeStr = System.getProperty("connection.scheme");
- for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) {
- AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme,
- clusterServices);
- if (schemeImpl != null) {
- schemes.put(scheme, schemeImpl);
- if (scheme.name().equalsIgnoreCase(schemeStr)) {
- activeScheme = scheme;
- }
- }
- }
connectionEventThread.start();
"ConnectionEvent Thread");
this.connectionEvents = new LinkedBlockingQueue<ConnectionMgmtEvent>();
schemes = new ConcurrentHashMap<ConnectionMgmtScheme, AbstractScheme>();
+
+ String schemeStr = System.getProperty("connection.scheme");
+ for (ConnectionMgmtScheme scheme : ConnectionMgmtScheme.values()) {
+ AbstractScheme schemeImpl = SchemeFactory.getScheme(scheme, clusterServices);
+ if (schemeImpl != null) {
+ schemes.put(scheme, schemeImpl);
+ if (scheme.name().equalsIgnoreCase(schemeStr)) {
+ activeScheme = scheme;
+ }
+ }
+ }
}
public void stopping() {
}
/*
- * Clustering Services' doesnt provide the existing states in the cache
+ * Clustering Services doesn't provide the existing states in the cache
* update callbacks. Hence, using a scratch local cache to maintain the
* existing state.
*/
return;
Set<InetAddress> existingControllers = existingConnections.get(node);
if (existingControllers != null) {
- logger.debug(
- "Processing Update for : {} NewControllers : {} existingControllers : {}",
- node, newControllers.toString(),
- existingControllers.toString());
+ logger.debug("Processing Update for : {} NewControllers : {} existingControllers : {}", node,
+ newControllers.toString(), existingControllers.toString());
if (newControllers.size() < existingControllers.size()) {
- Set<InetAddress> removed = new HashSet<InetAddress>(
- existingControllers);
+ Set<InetAddress> removed = new HashSet<InetAddress>(existingControllers);
if (removed.removeAll(newControllers)) {
logger.debug("notifyNodeDisconnectFromMaster({})", node);
notifyNodeDisconnectedEvent(node);
}
}
} else {
- logger.debug("Ignoring the Update for : {} NewControllers : {}",
- node, newControllers.toString());
+ logger.debug("Ignoring the Update for : {} NewControllers : {}", node, newControllers.toString());
}
existingConnections.put(node, newControllers);
}
public void entryDeleted(Node key, String cacheName, boolean originLocal) {
if (originLocal)
return;
- logger.debug("Deleted : {} cache : {}", key, cacheName);
+ logger.debug("Deleted entry {} from cache : {}", key, cacheName);
notifyNodeDisconnectedEvent(key);
}
allocateCaches();
retrieveCaches();
} else {
- log.error("Couldn't retrieve caches for scheme %s. Clustering service unavailable", name);
+ log.error("Couldn't retrieve caches for scheme {}. Clustering service unavailable", name);
}
}
log.error("An error occured",e);
}
}
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((nodeConnections == null) ? 0 : nodeConnections.hashCode());
+ result = prime * result + ((nodeConnectionsCacheName == null) ? 0 : nodeConnectionsCacheName.hashCode());
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (!(obj instanceof AbstractScheme)) {
+ return false;
+ }
+ AbstractScheme other = (AbstractScheme) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
+ }
+ if (nodeConnections == null) {
+ if (other.nodeConnections != null) {
+ return false;
+ }
+ } else if (!nodeConnections.equals(other.nodeConnections)) {
+ return false;
+ }
+ if (nodeConnectionsCacheName == null) {
+ if (other.nodeConnectionsCacheName != null) {
+ return false;
+ }
+ } else if (!nodeConnectionsCacheName.equals(other.nodeConnectionsCacheName)) {
+ return false;
+ }
+ return true;
+ }
}
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import com.fasterxml.jackson.databind.ObjectMapper;
import org.opendaylight.controller.connectionmanager.IConnectionManager;
import org.opendaylight.controller.forwarding.staticrouting.IForwardingStaticRouting;
import org.opendaylight.controller.forwarding.staticrouting.StaticRouteConfig;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
for (NodeConnector nodeConnector : nodeConnectorSet) {
String nodeConnectorNumberToStr = nodeConnector.getID().toString();
Name ncName = ((Name) switchManager.getNodeConnectorProp(nodeConnector, Name.NamePropName));
- Config portStatus = ((Config) switchManager.getNodeConnectorProp(nodeConnector,
+ Config portConfig = ((Config) switchManager.getNodeConnectorProp(nodeConnector,
Config.ConfigPropName));
State portState = ((State) switchManager.getNodeConnectorProp(nodeConnector,
State.StatePropName));
String nodeConnectorName = (ncName != null) ? ncName.getValue() : "";
nodeConnectorName += " (" + nodeConnector.getID() + ")";
- if (portStatus != null) {
- if (portStatus.getValue() == Config.ADMIN_UP) {
- if (portState.getValue() == State.EDGE_UP) {
+ if (portConfig != null) {
+ if (portConfig.getValue() == Config.ADMIN_UP) {
+ if (portState != null && portState.getValue() == State.EDGE_UP) {
nodeConnectorName = "<span class='admin-up'>" + nodeConnectorName + "</span>";
- } else if (portState.getValue() == State.EDGE_DOWN) {
+ } else if (portState == null || portState.getValue() == State.EDGE_DOWN) {
nodeConnectorName = "<span class='edge-down'>" + nodeConnectorName + "</span>";
}
- } else if (portStatus.getValue() == Config.ADMIN_DOWN) {
+ } else if (portConfig.getValue() == Config.ADMIN_DOWN) {
nodeConnectorName = "<span class='admin-down'>" + nodeConnectorName + "</span>";
}
}