X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fcore%2Fconnection%2FAbstractOutboundQueueManager.java;h=99bec867e582ae60c2996c67a483ac014c53b679;hb=3545506a79947dec9b4ded9afe51388dadb16e27;hp=49c6ddfa9fb47c155796cbdb3d453cd36704c22d;hpb=deca37b27340c6e9b1576c281982d5d7f4ee1795;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractOutboundQueueManager.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractOutboundQueueManager.java index 49c6ddfa..99bec867 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractOutboundQueueManager.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/connection/AbstractOutboundQueueManager.java @@ -29,7 +29,8 @@ import org.slf4j.LoggerFactory; * Class capsulate basic processing for stacking requests for netty channel * and provide functionality for pairing request/response device message communication. */ -abstract class AbstractOutboundQueueManager extends ChannelInboundHandlerAdapter +abstract class AbstractOutboundQueueManager + extends ChannelInboundHandlerAdapter implements AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(AbstractOutboundQueueManager.class); @@ -67,7 +68,7 @@ abstract class AbstractOutboundQueueManager exte private final AtomicBoolean flushScheduled = new AtomicBoolean(); protected final ConnectionAdapterImpl parent; protected final InetSocketAddress address; - protected final StackedOutboundQueue currentQueue; + protected final O currentQueue; private final T handler; // Accessed concurrently @@ -89,12 +90,20 @@ abstract class AbstractOutboundQueueManager exte this.parent = Preconditions.checkNotNull(parent); this.handler = Preconditions.checkNotNull(handler); this.address = address; - currentQueue = new StackedOutboundQueue(this); + /* Note: don't wish to use reflection here */ + currentQueue = initializeStackedOutboudnqueue(); LOG.debug("Queue manager instantiated with queue {}", currentQueue); handler.onConnectionQueueChanged(currentQueue); } + /** + * Method has to initialize some child of {@link AbstractStackedOutboundQueue} + * + * @return correct implementation of StacketOutboundqueue + */ + protected abstract O initializeStackedOutboudnqueue(); + @Override public void close() { handler.onConnectionQueueChanged(null);