package org.opendaylight.openflowplugin.applications.statistics.manager.impl;
+import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
for loading all Nodes to Operational/DS
*/
private static final long WAIT_BEFORE_COLLECTING_STATS = 5000;
+ private static final TransactionId FAKE_TX_ID = new TransactionId(new BigInteger("FFFFFFFFFFFFFFFF", 16));
private final ExecutorService statNetCollectorServ;
private final StatisticsManager manager;
private boolean checkTransactionId(final TransactionId xid) {
synchronized (transNotifyLock) {
- return actualTransactionId != null && actualTransactionId.equals(xid);
+ return actualTransactionId != null
+ && (actualTransactionId.equals(xid) || actualTransactionId.equals(FAKE_TX_ID));
}
}
actualTransactionId = transactionId;
}
}
+
+ public static TransactionId getFakeTxId() {
+ return FAKE_TX_ID;
+ }
}
package org.opendaylight.openflowplugin.applications.statistics.manager.impl;
+import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException;
import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
import org.opendaylight.openflowplugin.applications.statistics.manager.StatRpcMsgManager;
import org.opendaylight.openflowplugin.applications.statistics.manager.StatisticsManager;
public void onFailure(final Throwable t) {
LOG.warn("Response Registration for Statistics RPC call fail!", t);
if (resultTransId != null) {
- resultTransId.setException(t);
+ if (t instanceof DOMRpcImplementationNotAvailableException) {
+ //If encountered with RPC not availabe exception, retry till
+ // stats manager remove the node from the stats collector pool
+ resultTransId.set(StatPermCollectorImpl.getFakeTxId());
+ } else {
+ resultTransId.setException(t);
+ }
}
}
}
//Node added notification need to be sent irrespective of whether
// *this* instance is owner of the entity or not. Because yang notifications
// are local, and we should maintain the behavior across the application.
- LOG.info("sendNodeAddedNotification: Node Added notification is sent for ModelDrivenSwitch {}",
- entityMetadata.getOfSwitch().getNodeId().getValue());
+ if (entityMetadata != null && entityMetadata.getOfSwitch() != null) {
+ LOG.info("sendNodeAddedNotification: Node Added notification is sent for ModelDrivenSwitch {}",
+ entityMetadata.getOfSwitch().getNodeId().getValue());
- entityMetadata.getContext().getNotificationEnqueuer().enqueueNotification(
- entityMetadata.getWrappedNotification());
+ entityMetadata.getContext().getNotificationEnqueuer().enqueueNotification(
+ entityMetadata.getWrappedNotification());
- //Send multipart request to get other details of the switch.
- entityMetadata.getOfSwitch().requestSwitchDetails();
+ //Send multipart request to get other details of the switch.
+ entityMetadata.getOfSwitch().requestSwitchDetails();
+ } else {
+ LOG.debug("Switch got disconnected, skip node added notification.");
+ }
}
private void setDeviceOwnershipState(Entity entity, boolean isMaster) {