import io.netty.util.Timeout;
import io.netty.util.TimerTask;
+import org.opendaylight.openflowplugin.api.openflow.OFPManager;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceManager;
*/
DeviceContext getDeviceContext(DeviceInfo deviceInfo);
+
+ /**
+ * Setter for device manager once set it cant be unset or overwritten
+ * @param manager
+ */
+ void setSafelyManager(OFPManager manager);
+
/**
* Registers ont time listener for notify when services rpc, statistics are done stop or start
* @param manager service change listener
*/
void closeConnection(final DeviceInfo deviceInfo);
- /**
- * Setter for device manager once set it cant be unset or overwritten
- * @param deviceManager should be set in OpenFlowPluginProviderImpl
- */
- void setSafelyDeviceManager(final DeviceManager deviceManager);
-
- /**
- * Setter for statistics manager once set it cant be unset or overwritten
- * @param statisticsManager should be set in OpenFlowPluginProviderImpl
- */
- void setSafelyStatisticsManager(final StatisticsManager statisticsManager);
-
/**
* Xid from outboundqueue
* @param deviceInfo
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
+
+import org.opendaylight.openflowplugin.api.openflow.OFPManager;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.RoleChangeListener;
import org.opendaylight.openflowplugin.api.openflow.lifecycle.ServiceChangeListener;
+import org.opendaylight.openflowplugin.api.openflow.rpc.RpcManager;
import org.opendaylight.openflowplugin.api.openflow.statistics.StatisticsManager;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
/**
*/
-public final class LifecycleConductorImpl implements LifecycleConductor, RoleChangeListener, DeviceContextChangeListener {
+final class LifecycleConductorImpl implements LifecycleConductor, RoleChangeListener, DeviceContextChangeListener {
private static final Logger LOG = LoggerFactory.getLogger(LifecycleConductorImpl.class);
private static final int TICKS_PER_WHEEL = 500;
private final HashedWheelTimer hashedWheelTimer = new HashedWheelTimer(TICK_DURATION, TimeUnit.MILLISECONDS, TICKS_PER_WHEEL);
private DeviceManager deviceManager;
+ private StatisticsManager statisticsManager;
+ private RpcManager rpcManager;
private final MessageIntelligenceAgency messageIntelligenceAgency;
private ConcurrentHashMap<DeviceInfo, ServiceChangeListener> serviceChangeListeners = new ConcurrentHashMap<>();
- private StatisticsManager statisticsManager;
LifecycleConductorImpl(final MessageIntelligenceAgency messageIntelligenceAgency) {
Preconditions.checkNotNull(messageIntelligenceAgency);
}
@Override
- public void setSafelyDeviceManager(final DeviceManager deviceManager) {
- if (this.deviceManager == null) {
- this.deviceManager = deviceManager;
+ public void setSafelyManager(final OFPManager manager){
+ if (manager == null) {
+ LOG.info("Manager {} is already defined in conductor. ", manager);
}
- }
-
- @Override
- public void setSafelyStatisticsManager(final StatisticsManager statisticsManager) {
- if (this.statisticsManager == null) {
- this.statisticsManager = statisticsManager;
+ if (manager instanceof RpcManager) {
+ this.rpcManager = (RpcManager) manager;
+ } else {
+ if (manager instanceof StatisticsManager) {
+ this.statisticsManager = (StatisticsManager) manager;
+ } else {
+ if (manager instanceof DeviceManager) {
+ this.deviceManager = (DeviceManager) manager;
+ }
+ }
}
}
conductor);
((ExtensionConverterProviderKeeper) deviceManager).setExtensionConverterProvider(extensionConverterManager);
- conductor.setSafelyDeviceManager(deviceManager);
+ conductor.setSafelyManager(deviceManager);
roleManager = new RoleManagerImpl(entityOwnershipService, dataBroker, conductor);
statisticsManager = new StatisticsManagerImpl(rpcProviderRegistry, isStatisticsPollingOff, conductor);
- conductor.setSafelyStatisticsManager(statisticsManager);
+ conductor.setSafelyManager(statisticsManager);
rpcManager = new RpcManagerImpl(rpcProviderRegistry, rpcRequestsQuota, conductor);
-
+ conductor.setSafelyManager(rpcManager);
roleManager.addRoleChangeListener((RoleChangeListener) conductor);
/* Initialization Phase ordering - OFP Device Context suite */