Make DispatcherImpl an abstract class 35/1135/2
authorRobert Varga <rovarga@cisco.com>
Mon, 9 Sep 2013 15:08:11 +0000 (17:08 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 9 Sep 2013 15:38:54 +0000 (17:38 +0200)
This eliminates Dispatcher as a concept, and turns the corresponding
implementation into an utility class. The original resource sharing of a
dispatcher implementation will be realized via netty thread group
sharing.

Change-Id: I06b0fe0e8cdd7e51840fac316c714d6faa8aed0e
Signed-off-by: Robert Varga <rovarga@cisco.com>
12 files changed:
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImpl.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/Main.java
bgp/testtool/src/main/java/org/opendaylight/protocol/bgp/testtool/TestingListener.java
bgp/testtool/src/test/java/org/opendaylight/protocol/bgp/testtool/BGPSpeakerMock.java
bgp/testtool/src/test/java/org/opendaylight/protocol/bgp/testtool/SpeakerSessionListener.java
framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java [moved from framework/src/main/java/org/opendaylight/protocol/framework/DispatcherImpl.java with 61% similarity]
framework/src/main/java/org/opendaylight/protocol/framework/Dispatcher.java [deleted file]
framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java
framework/src/test/java/org/opendaylight/protocol/framework/ServerTest.java
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java
pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java
pcep/testtool/src/test/java/org/opendaylight/protocol/pcep/testtool/PCCMock.java

index d6d165fc1520fca1e7a50becc6cc8e4b1641449c..698743c9a8bb578fe4ed558039b8391268ce113d 100644 (file)
@@ -18,7 +18,7 @@ import org.opendaylight.protocol.bgp.parser.BGPSession;
 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
-import org.opendaylight.protocol.framework.Dispatcher;
+import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
 import org.opendaylight.protocol.framework.ReconnectStrategy;
 
@@ -27,23 +27,18 @@ import com.google.common.base.Preconditions;
 /**
  * Implementation of BGPDispatcher.
  */
-public final class BGPDispatcherImpl implements BGPDispatcher {
+public final class BGPDispatcherImpl extends AbstractDispatcher implements BGPDispatcher {
        private final Timer timer = new HashedWheelTimer();
        private final ProtocolMessageFactory<BGPMessage> parser;
-       private final Dispatcher dispatcher;
 
-       public BGPDispatcherImpl(final Dispatcher dispatcher, final ProtocolMessageFactory<BGPMessage> parser) {
-               this.dispatcher = Preconditions.checkNotNull(dispatcher);
+       public BGPDispatcherImpl(final ProtocolMessageFactory<BGPMessage> parser) {
+               super();
                this.parser = Preconditions.checkNotNull(parser);
        }
 
        @Override
        public Future<? extends BGPSession> createClient(final InetSocketAddress address, final BGPSessionPreferences preferences,
                        final BGPSessionListener listener, final ReconnectStrategy strategy) {
-               return this.dispatcher.createClient(address, listener, new BGPSessionNegotiatorFactory(timer, preferences), parser, strategy);
-       }
-
-       public Dispatcher getDispatcher() {
-               return this.dispatcher;
+               return createClient(address, listener, new BGPSessionNegotiatorFactory(timer, preferences), parser, strategy);
        }
 }
index bce9db2a60a52bf85a7cae7ac6f685de3584abe5..1d90e240c0f78d59b998501da8745e91677b22bd 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4Address;
-import org.opendaylight.protocol.framework.DispatcherImpl;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -50,7 +49,7 @@ public class Main {
        BGPDispatcherImpl dispatcher;
 
        public Main() throws IOException {
-               this.dispatcher = new BGPDispatcherImpl(new DispatcherImpl(), new BGPMessageFactory());
+               this.dispatcher = new BGPDispatcherImpl(new BGPMessageFactory());
        }
 
        public static void main(final String[] args) throws NumberFormatException, IOException {
@@ -83,7 +82,7 @@ public class Main {
 
                final Main m = new Main();
 
-               final BGPSessionListener sessionListener = new TestingListener((DispatcherImpl) m.dispatcher.getDispatcher());
+               final BGPSessionListener sessionListener = new TestingListener();
 
                final BGPSessionProposalImpl prop = new BGPSessionProposalImpl(holdTimerValue, as, new IPv4Address(InetAddress.getByName("25.25.25.2")));
 
index a61cce23f82e8561f8044aa307bc38a443634e6a..37cb37bd1df30e08331ddbd777a977a366579a17 100644 (file)
@@ -11,7 +11,6 @@ import org.opendaylight.protocol.bgp.parser.BGPMessage;
 import org.opendaylight.protocol.bgp.parser.BGPSession;
 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
 import org.opendaylight.protocol.bgp.parser.BGPTerminationReason;
-import org.opendaylight.protocol.framework.DispatcherImpl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -21,12 +20,6 @@ import org.slf4j.LoggerFactory;
 public class TestingListener implements BGPSessionListener {
        private static final Logger logger = LoggerFactory.getLogger(TestingListener.class);
 
-       DispatcherImpl d;
-
-       TestingListener(final DispatcherImpl d) {
-               this.d = d;
-       }
-
        @Override
        public void onMessage(final BGPSession session, final BGPMessage message) {
                logger.info("Client Listener: message received: {}", message.toString());
@@ -41,12 +34,10 @@ public class TestingListener implements BGPSessionListener {
        public void onSessionDown(final BGPSession session, final Exception e) {
                logger.info("Client Listener: Connection lost.");
                session.close();
-               // this.d.stop();
        }
 
        @Override
        public void onSessionTerminated(final BGPSession session, final BGPTerminationReason cause) {
                logger.info("Client Listener: Connection lost: {}.", cause);
-               // this.d.stop();
        }
 }
index 9ba7954047005fc89fbec0b74275617fce438686..d0c021def3cf069037b2a83d8653369f4e38cbd8 100644 (file)
@@ -19,12 +19,10 @@ import org.opendaylight.protocol.bgp.rib.impl.BGPSessionProposalImpl;
 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences;
 import org.opendaylight.protocol.concepts.ASNumber;
 import org.opendaylight.protocol.concepts.IPv4;
-import org.opendaylight.protocol.framework.DispatcherImpl;
+import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 
-public class BGPSpeakerMock {
-
-       DispatcherImpl dispatcher = new DispatcherImpl();
+public class BGPSpeakerMock extends AbstractDispatcher {
 
        public static void main(final String[] args) throws IOException {
 
@@ -35,11 +33,11 @@ public class BGPSpeakerMock {
                final SessionListenerFactory<BGPSessionListener> f = new SessionListenerFactory<BGPSessionListener>() {
                        @Override
                        public BGPSessionListener getSessionListener() {
-                               return new SpeakerSessionListener(m.dispatcher);
+                               return new SpeakerSessionListener(m);
                        }
                };
 
-               m.dispatcher.createServer(new InetSocketAddress("127.0.0.2", 12345), f,
+               m.createServer(new InetSocketAddress("127.0.0.2", 12345), f,
                                new BGPSessionNegotiatorFactory(new HashedWheelTimer(), prefs), new BGPMessageFactory());
        }
 }
index cbee49564b10341c461fff3ae066fd16fa99550b..07b401efe0e4d9aee8ae976fa9a2af0aa38aff48 100644 (file)
@@ -11,16 +11,16 @@ import org.opendaylight.protocol.bgp.parser.BGPMessage;
 import org.opendaylight.protocol.bgp.parser.BGPSession;
 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
 import org.opendaylight.protocol.bgp.parser.BGPTerminationReason;
-import org.opendaylight.protocol.framework.DispatcherImpl;
+import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class SpeakerSessionListener implements BGPSessionListener {
        private static final Logger logger = LoggerFactory.getLogger(SpeakerSessionListener.class);
 
-       DispatcherImpl d;
+       AbstractDispatcher d;
 
-       SpeakerSessionListener(final DispatcherImpl d) {
+       SpeakerSessionListener(final AbstractDispatcher d) {
                this.d = d;
        }
 
similarity index 61%
rename from framework/src/main/java/org/opendaylight/protocol/framework/DispatcherImpl.java
rename to framework/src/main/java/org/opendaylight/protocol/framework/AbstractDispatcher.java
index a6019d0da1322679e299ed3ec2a0036a7d73b0c2..2179671fde1d6b320311007abffcd50be367ff59 100644 (file)
@@ -29,22 +29,31 @@ import com.google.common.base.Preconditions;
  * Dispatcher class for creating servers and clients. The idea is to first create servers and clients and the run the
  * start method that will handle sockets in different thread.
  */
-public final class DispatcherImpl implements Closeable, Dispatcher {
+public abstract class AbstractDispatcher implements Closeable {
 
-       private static final Logger logger = LoggerFactory.getLogger(DispatcherImpl.class);
+       private static final Logger logger = LoggerFactory.getLogger(AbstractDispatcher.class);
 
        private final EventLoopGroup bossGroup;
 
        private final EventLoopGroup workerGroup;
 
-       public DispatcherImpl() {
+       protected AbstractDispatcher() {
                // FIXME: we should get these as arguments
                this.bossGroup = new NioEventLoopGroup();
                this.workerGroup = new NioEventLoopGroup();
        }
 
-       @Override
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> ChannelFuture createServer(
+       /**
+        * Creates server. Each server needs factories to pass their instances to client sessions.
+        * 
+        * @param address address to which the server should be bound
+        * @param listenerFactory factory for creating protocol listeners, passed to the negotiator
+        * @param negotiatorFactory protocol session negotiator factory
+        * @param messageFactory message parser
+        * 
+        * @return ChannelFuture representing the binding process
+        */
+       protected <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> ChannelFuture createServer(
                        final InetSocketAddress address, final SessionListenerFactory<L> listenerFactory,
                        final SessionNegotiatorFactory<M, S, L> negotiatorFactory, final ProtocolMessageFactory<M> messageFactory) {
                final ServerBootstrap b = new ServerBootstrap();
@@ -62,8 +71,19 @@ public final class DispatcherImpl implements Closeable, Dispatcher {
 
        }
 
-       @Override
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<S> createClient(
+       /**
+        * Creates a client.
+        * 
+        * @param address remote address
+        * @param listener session listener
+        * @param negotiatorFactory session negotiator factory
+        * @param messageFactory message parser
+        * @param connectStrategy Reconnection strategy to be used when initial connection fails
+        * 
+        * @return Future representing the connection process. Its result represents
+        *         the combined success of TCP connection as well as session negotiation.
+        */
+       protected <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<S> createClient(
                        final InetSocketAddress address, final L listener, final SessionNegotiatorFactory<M, S, L> negotiatorFactory,
                        final ProtocolMessageFactory<M> messageFactory, final ReconnectStrategy strategy) {
                final ProtocolSessionPromise<M, S, L> p = new ProtocolSessionPromise<M, S, L>(workerGroup, address, negotiatorFactory,
@@ -84,8 +104,22 @@ public final class DispatcherImpl implements Closeable, Dispatcher {
                return p;
        }
 
-       @Override
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<Void> createReconnectingClient(
+       /**
+        * Creates a client.
+        * 
+        * @param address remote address
+        * @param listener session listener
+        * @param negotiatorFactory session negotiator factory
+        * @param messageFactory message parser
+        * @param connectStrategyFactory Factory for creating reconnection strategy to be used when initial connection fails
+        * @param reestablishStrategy Reconnection strategy to be used when the already-established session fails
+        * 
+        * @return Future representing the reconnection task. It will report
+        *         completion based on reestablishStrategy, e.g. success if
+        *         it indicates no further attempts should be made and failure
+        *         if it reports an error
+        */
+       protected <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<Void> createReconnectingClient(
                        final InetSocketAddress address, final L listener, final SessionNegotiatorFactory<M, S, L> negotiatorFactory,
                        final ProtocolMessageFactory<M> messageFactory, final ReconnectStrategyFactory connectStrategyFactory,
                        final ReconnectStrategy reestablishStrategy) {
diff --git a/framework/src/main/java/org/opendaylight/protocol/framework/Dispatcher.java b/framework/src/main/java/org/opendaylight/protocol/framework/Dispatcher.java
deleted file mode 100644 (file)
index 4a4d160..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.framework;
-
-import io.netty.channel.ChannelFuture;
-import io.netty.util.concurrent.Future;
-
-import java.net.InetSocketAddress;
-
-/**
- * Dispatcher class for creating protocol servers and clients.
- */
-public interface Dispatcher {
-       /**
-        * Creates server. Each server needs factories to pass their instances to client sessions.
-        * 
-        * @param address address to which the server should be bound
-        * @param listenerFactory factory for creating protocol listeners, passed to the negotiator
-        * @param negotiatorFactory protocol session negotiator factory
-        * @param messageFactory message parser
-        * 
-        * @return ChannelFuture representing the binding process
-        */
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> ChannelFuture createServer(
-                       InetSocketAddress address,  final SessionListenerFactory<L> listenerFactory,
-                       SessionNegotiatorFactory<M, S, L> negotiatorFactory, ProtocolMessageFactory<M> messageFactory);
-
-       /**
-        * Creates a client.
-        * 
-        * @param address remote address
-        * @param listener session listener
-        * @param negotiatorFactory session negotiator factory
-        * @param messageFactory message parser
-        * @param connectStrategy Reconnection strategy to be used when initial connection fails
-        * 
-        * @return Future representing the connection process. Its result represents
-        *         the combined success of TCP connection as well as session negotiation.
-        */
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<S> createClient(
-                       InetSocketAddress address, final L listener, SessionNegotiatorFactory<M, S, L> negotiatorFactory,
-                       ProtocolMessageFactory<M> messageFactory, ReconnectStrategy connectStrategy);
-
-       /**
-        * Creates a client.
-        * 
-        * @param address remote address
-        * @param listener session listener
-        * @param negotiatorFactory session negotiator factory
-        * @param messageFactory message parser
-        * @param connectStrategyFactory Factory for creating reconnection strategy to be used when initial connection fails
-        * @param reestablishStrategy Reconnection strategy to be used when the already-established session fails
-        * 
-        * @return Future representing the reconnection task. It will report
-        *         completion based on reestablishStrategy, e.g. success if
-        *         it indicates no further attempts should be made and failure
-        *         if it reports an error
-        */
-       public <M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> Future<Void> createReconnectingClient(
-                       final InetSocketAddress address, final L listener, final SessionNegotiatorFactory<M, S, L> negotiatorFactory,
-                       final ProtocolMessageFactory<M> messageFactory,
-                       final ReconnectStrategyFactory connectStrategyFactory, final ReconnectStrategy reestablishStrategy);
-}
index 049263553392af86221b74c62ab1e203105a4e3b..a37572cb2078464c247ef8fe2d5ed0519e972273 100644 (file)
@@ -16,7 +16,7 @@ import java.net.InetSocketAddress;
 import com.google.common.base.Preconditions;
 
 final class ReconnectPromise<M extends ProtocolMessage, S extends ProtocolSession<M>, L extends SessionListener<M, ?, ?>> extends DefaultPromise<Void> {
-       private final Dispatcher dispatcher;
+       private final AbstractDispatcher dispatcher;
        private final InetSocketAddress address;
        private final L listener;
        private final SessionNegotiatorFactory<M, S, L> negotiatorFactory;
@@ -25,7 +25,7 @@ final class ReconnectPromise<M extends ProtocolMessage, S extends ProtocolSessio
        private final ReconnectStrategy strategy;
        private Future<?> pending;
 
-       public ReconnectPromise(final Dispatcher dispatcher,
+       public ReconnectPromise(final AbstractDispatcher dispatcher,
                        final InetSocketAddress address, final L listener,
                        final SessionNegotiatorFactory<M, S, L> negotiatorFactory,
                        final ProtocolMessageFactory<M> messageFactory,
index 7db714241c78aa5bef8e2760e2f723f607a26e74..3eaf923d7b393b21897b5ad04ede50aa2d12bd2e 100644 (file)
@@ -28,7 +28,7 @@ import org.junit.Test;
 public class ServerTest {
        public static final int PORT = 18080;
 
-       DispatcherImpl clientDispatcher, dispatcher;
+       AbstractDispatcher clientDispatcher, dispatcher;
 
        final SimpleSessionListener pce = new SimpleSessionListener();
 
@@ -40,7 +40,7 @@ public class ServerTest {
 
        @Test
        public void testConnectionEstablished() throws Exception {
-               this.dispatcher = new DispatcherImpl();
+               this.dispatcher = new AbstractDispatcher() { };
 
                final Promise<Boolean> p = new DefaultPromise<>(GlobalEventExecutor.INSTANCE);
 
@@ -61,7 +61,7 @@ public class ServerTest {
 
                this.server.get();
 
-               this.clientDispatcher = new DispatcherImpl();
+               this.clientDispatcher = new AbstractDispatcher() { };
 
                this.session = this.clientDispatcher.createClient(this.serverAddress, new SimpleSessionListener(),
                                new SessionNegotiatorFactory<SimpleMessage, SimpleSession, SimpleSessionListener>() {
@@ -77,8 +77,8 @@ public class ServerTest {
        }
 
        public void testConnectionFailed() throws IOException, InterruptedException {
-               this.dispatcher = new DispatcherImpl();
-               this.clientDispatcher = new DispatcherImpl();
+               this.dispatcher = new AbstractDispatcher() { };
+               this.clientDispatcher = new AbstractDispatcher() { };
                final SimpleSessionListener listener = new SimpleSessionListener();
 
                try {
index 865e36ae023911bbcf438fc37414d326e50d3379..2feaed9b83085335f5c2d34f126de180eeef9365 100644 (file)
@@ -14,7 +14,7 @@ import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.util.concurrent.ExecutionException;
 
-import org.opendaylight.protocol.framework.Dispatcher;
+import org.opendaylight.protocol.framework.AbstractDispatcher;
 import org.opendaylight.protocol.framework.ReconnectStrategy;
 import org.opendaylight.protocol.framework.SessionListenerFactory;
 import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
@@ -26,24 +26,23 @@ import org.opendaylight.protocol.pcep.PCEPSessionListener;
 /**
  * Implementation of PCEPDispatcher.
  */
-public class PCEPDispatcherImpl implements PCEPDispatcher {
+public class PCEPDispatcherImpl extends AbstractDispatcher implements PCEPDispatcher {
        private static final PCEPMessageFactory msgFactory = new PCEPMessageFactory();
        private final SessionNegotiatorFactory<PCEPMessage, PCEPSessionImpl, PCEPSessionListener> snf;
-       private final Dispatcher dispatcher;
 
        /**
         * Creates an instance of PCEPDispatcherImpl, gets the default selector and opens it.
         * 
         * @throws IOException if some error occurred during opening the selector
         */
-       public PCEPDispatcherImpl(final Dispatcher dispatcher, final SessionNegotiatorFactory<PCEPMessage, PCEPSessionImpl, PCEPSessionListener> snf) {
-               this.dispatcher = dispatcher;
+       public PCEPDispatcherImpl(final SessionNegotiatorFactory<PCEPMessage, PCEPSessionImpl, PCEPSessionListener> snf) {
+               super();
                this.snf = snf;
        }
 
        @Override
        public ChannelFuture createServer(final InetSocketAddress address, final SessionListenerFactory<PCEPSessionListener> listenerFactory) {
-               return this.dispatcher.createServer(address, listenerFactory, snf, msgFactory);
+               return this.createServer(address, listenerFactory, snf, msgFactory);
        }
 
        /**
@@ -54,6 +53,6 @@ public class PCEPDispatcherImpl implements PCEPDispatcher {
         */
        @Override
        public Future<? extends PCEPSession> createClient(final InetSocketAddress address, final PCEPSessionListener listener, final ReconnectStrategy strategy) {
-               return this.dispatcher.createClient(address, listener, snf, msgFactory, strategy);
+               return this.createClient(address, listener, snf, msgFactory, strategy);
        }
 }
index bb0df5e2f128928a8e74296bfca5c97723f30004..ba29b91845fd7b59cc7a526638eabce27c64b367 100644 (file)
@@ -12,7 +12,6 @@ import io.netty.util.HashedWheelTimer;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
 
-import org.opendaylight.protocol.framework.DispatcherImpl;
 import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
 import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
@@ -118,8 +117,7 @@ public class Main {
 
                final PCEPOpenObject prefs = spf.getSessionProposal(address, 0);
 
-               final DispatcherImpl d = new DispatcherImpl();
-               final PCEPDispatcherImpl dispatcher = new PCEPDispatcherImpl(d, new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), prefs, 5));
+               final PCEPDispatcherImpl dispatcher = new PCEPDispatcherImpl(new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), prefs, 5));
 
                dispatcher.createServer(address, new TestingSessionListenerFactory()).get();
        }
index 5b408f3d3668ea4e3feddb42ae0fdbc95c56c34a..8b0b76448c3d70682c650505584520cdb641f9fd 100644 (file)
@@ -13,7 +13,6 @@ import io.netty.util.concurrent.GlobalEventExecutor;
 import java.net.InetSocketAddress;
 import java.util.List;
 
-import org.opendaylight.protocol.framework.DispatcherImpl;
 import org.opendaylight.protocol.framework.NeverReconnectStrategy;
 import org.opendaylight.protocol.pcep.PCEPTlv;
 import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
@@ -29,8 +28,7 @@ public class PCCMock {
                final List<PCEPTlv> tlvs = Lists.newArrayList();
                tlvs.add(new NodeIdentifierTlv(new byte[] { (byte) 127, (byte) 2, (byte) 3, (byte) 7 }));
 
-               final DispatcherImpl di = new DispatcherImpl();
-               final PCEPDispatcherImpl d = new PCEPDispatcherImpl(di, new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), new PCEPOpenObject(30, 120, 0, tlvs), 0));
+               final PCEPDispatcherImpl d = new PCEPDispatcherImpl(new DefaultPCEPSessionNegotiatorFactory(new HashedWheelTimer(), new PCEPOpenObject(30, 120, 0, tlvs), 0));
 
                try {
                        d.createClient(new InetSocketAddress("127.0.0.3", 12345), new SimpleSessionListener(),