When the cluster is rebooted hwvtep operational datastore is not populated
for the existing clients.
Existing clients keep retrying , the moment 6640 port is up they establish
connection.
But by that time hwtep bundle is not up.
Eventually when the bundle is up it is only notified of future clients
only and not the already existing clients.
Change-Id: Ic816aea61c43000d7c8fbf14e51e0bcc5661664e
Signed-off-by: K.V Suneelu Verma <k.v.suneelu.verma@ericsson.com>
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
= Executors.newCachedThreadPool(connectionNotifierThreadFactory);
private static Set<OvsdbConnectionListener> connectionListeners = Sets.newHashSet();
= Executors.newCachedThreadPool(connectionNotifierThreadFactory);
private static Set<OvsdbConnectionListener> connectionListeners = Sets.newHashSet();
- private static Map<OvsdbClient, Channel> connections = Maps.newHashMap();
+ private static Map<OvsdbClient, Channel> connections = new ConcurrentHashMap<>();
private static OvsdbConnection connectionService;
private static volatile boolean singletonCreated = false;
private static final int IDLE_READER_TIMEOUT = 30;
private static OvsdbConnection connectionService;
private static volatile boolean singletonCreated = false;
private static final int IDLE_READER_TIMEOUT = 30;
public void registerConnectionListener(OvsdbConnectionListener listener) {
LOG.info("registerConnectionListener: registering {}", listener.getClass().getSimpleName());
connectionListeners.add(listener);
public void registerConnectionListener(OvsdbConnectionListener listener) {
LOG.info("registerConnectionListener: registering {}", listener.getClass().getSimpleName());
connectionListeners.add(listener);
+ notifyAlreadyExistingConnectionsToListener(listener);
+ }
+
+ private void notifyAlreadyExistingConnectionsToListener(final OvsdbConnectionListener listener) {
+ for (final OvsdbClient client : getConnections()) {
+ connectionNotifierService.submit(new Runnable() {
+ @Override
+ public void run() {
+ LOG.trace("Connection {} notified to listener {}", client.getConnectionInfo(), listener);
+ listener.connected(client);
+ }
+ });
+ }