import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
import org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginTimer;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceContextClosedHandler;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceDisconnectedHandler;
import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceReplyProcessor;
/**
- * Method registers outbound queue handler that should be invalidated when device context is closed.s
- * @param outboundQueueHandlerRegistration
+ * Method registers outbound queue provider into current device context's primary connection adapter.
+ *
+ * @param outboundQueueProvider
+ * @param maxQueueDepth
+ * @param barrierNanos
*/
- void registerOutboundQueueHandler(OutboundQueueHandlerRegistration outboundQueueHandlerRegistration);
+ void registerOutboundQueueProvider(OutboundQueueProvider outboundQueueProvider, int maxQueueDepth, long barrierNanos);
+
}
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueue;
import org.opendaylight.openflowjava.protocol.api.connection.OutboundQueueHandlerRegistration;
import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
+import org.opendaylight.openflowplugin.api.openflow.connection.OutboundQueueProvider;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
import org.opendaylight.openflowplugin.api.openflow.device.MessageTranslator;
private DeviceDisconnectedHandler deviceDisconnectedHandler;
private final Collection<DeviceContextClosedHandler> closeHandlers = new HashSet<>();
private NotificationPublishService notificationPublishService;
- private final OutboundQueue outboundQueueProvider;
+ private OutboundQueue outboundQueueProvider;
private final MultiMsgCollector multiMsgCollector = new MultiMsgCollectorImpl();
private volatile int outstandingNotificationsAmount = 0;
}
@Override
- public Long getReservedXid() {
+ public Long getReservedXid() {
return outboundQueueProvider.reserveEntry();
}
deviceMeterRegistry = new DeviceMeterRegistryImpl();
messageSpy = _messageSpy;
multiMsgCollector.setDeviceReplyProcessor(this);
- outboundQueueProvider = Preconditions.checkNotNull(primaryConnectionContext.getOutboundQueueProvider());
}
/**
}
@Override
- public void registerOutboundQueueHandler(final OutboundQueueHandlerRegistration outboundQueueHandlerRegistration) {
- this.outboundQueueHandlerRegistration = outboundQueueHandlerRegistration;
+ public void registerOutboundQueueProvider(final OutboundQueueProvider outboundQueueProvider, final int maxQueueDepth, final long barrierNanos) {
+ final ConnectionAdapter primaryConnectionAdapter = primaryConnectionContext.getConnectionAdapter();
+ outboundQueueHandlerRegistration = primaryConnectionAdapter.registerOutboundQueueHandler(outboundQueueProvider, maxQueueDepth, barrierNanos);
+ this.outboundQueueProvider = outboundQueueProvider;
+ primaryConnectionContext.setOutboundQueueProvider(outboundQueueProvider);
}
+
}
final Short version = connectionContext.getFeatures().getVersion();
OutboundQueueProvider outboundQueueProvider = new OutboundQueueProviderImpl(version);
- final OutboundQueueHandlerRegistration outboundQueueHandlerRegistration = connectionAdapter.registerOutboundQueueHandler(outboundQueueProvider, maxQueueDepth, barrierNanos);
- connectionContext.setOutboundQueueProvider(outboundQueueProvider);
-
final DeviceState deviceState = new DeviceStateImpl(connectionContext.getFeatures(), connectionContext.getNodeId());
final DeviceContext deviceContext = new DeviceContextImpl(connectionContext, deviceState, dataBroker, hashedWheelTimer, messageIntelligenceAgency);
- deviceContext.registerOutboundQueueHandler(outboundQueueHandlerRegistration);
+ deviceContext.registerOutboundQueueProvider(outboundQueueProvider, maxQueueDepth, barrierNanos);
deviceContext.setNotificationService(notificationService);
deviceContext.setNotificationPublishService(notificationPublishService);
NodeBuilder nodeBuilder = new NodeBuilder().setId(deviceState.getNodeId()).setNodeConnector(Collections.<NodeConnector>emptyList());