*/
package org.opendaylight.openflowplugin.impl.rpc;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.base.Verify;
import com.google.common.collect.Iterators;
private DeviceTerminationPhaseHandler deviceTerminPhaseHandler;
private final int maxRequestsQuota;
private final ConcurrentMap<NodeId, RpcContext> contexts = new ConcurrentHashMap<>();
- private boolean isStatisticsRpcEnabled;
- private NotificationPublishService notificationPublishService;
private final LifecycleConductor conductor;
final RpcContext rpcContext = new RpcContextImpl(
rpcProviderRegistry,
deviceContext,
+ deviceContext.getMessageSpy(),
maxRequestsQuota,
- isStatisticsRpcEnabled,
- notificationPublishService);
+ deviceContext.getDeviceState().getNodeInstanceIdentifier());
+
+ deviceContext.setRpcContext(rpcContext);
Verify.verify(contexts.putIfAbsent(nodeId, rpcContext) == null, "RpcCtx still not closed for node {}", nodeId);
}
}
-
@Override
public void onDeviceContextLevelDown(final DeviceContext deviceContext) {
final RpcContext removedContext = contexts.remove(deviceContext.getDeviceState().getNodeId());
}
deviceTerminPhaseHandler.onDeviceContextLevelDown(deviceContext);
}
- @Override
- public void setStatisticsRpcEnabled(final boolean isStatisticsRpcEnabled) {
- this.isStatisticsRpcEnabled = isStatisticsRpcEnabled;
- }
-
- @Override
- public void setNotificationPublishService(final NotificationPublishService notificationPublishService) {
- this.notificationPublishService = notificationPublishService;
- }
@Override
public void setDeviceTerminationPhaseHandler(final DeviceTerminationPhaseHandler handler) {
this.deviceTerminPhaseHandler = handler;
}
+
+ /**
+ * This method is only for testing
+ */
+ @VisibleForTesting
+ void addRecordToContexts(NodeId nodeId, RpcContext rpcContexts) {
+ if(!contexts.containsKey(nodeId)) {
+ this.contexts.put(nodeId,rpcContexts);
+ }
+ }
}