*/
package org.opendaylight.netconf.nettyutil;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import io.netty.bootstrap.Bootstrap;
import io.netty.bootstrap.ServerBootstrap;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GlobalEventExecutor;
import io.netty.util.concurrent.Promise;
-import java.io.Closeable;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import org.opendaylight.netconf.api.NetconfSession;
* start method that will handle sockets in different thread.
*/
@Deprecated
-public abstract class AbstractNetconfDispatcher<S extends NetconfSession, L extends NetconfSessionListener<? super S>>
- implements Closeable {
-
+public abstract class AbstractNetconfDispatcher<S extends NetconfSession, L extends NetconfSessionListener<? super S>> {
protected interface ChannelPipelineInitializer<C extends Channel, S extends NetconfSession> {
/**
* Initializes channel by specifying the handlers in its pipeline. Handlers are protocol specific, therefore
}
-
private static final Logger LOG = LoggerFactory.getLogger(AbstractNetconfDispatcher.class);
private final EventLoopGroup bossGroup;
protected AbstractNetconfDispatcher(final EventExecutor executor, final EventLoopGroup bossGroup,
final EventLoopGroup workerGroup) {
- this.bossGroup = Preconditions.checkNotNull(bossGroup);
- this.workerGroup = Preconditions.checkNotNull(workerGroup);
- this.executor = Preconditions.checkNotNull(executor);
+ this.bossGroup = requireNonNull(bossGroup);
+ this.workerGroup = requireNonNull(workerGroup);
+ this.executor = requireNonNull(executor);
}
return p;
}
- /**
- * Creates a client.
- *
- * @param address remote address
- * @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
- * @deprecated Use
- * {@link #createReconnectingClient(InetSocketAddress, ReconnectStrategyFactory, PipelineInitializer)}
- * instead.
- */
- @Deprecated
- protected Future<Void> createReconnectingClient(final InetSocketAddress address,
- final ReconnectStrategyFactory connectStrategyFactory, final ReconnectStrategy reestablishStrategy,
- final PipelineInitializer<S> initializer) {
- return createReconnectingClient(address, connectStrategyFactory, initializer);
- }
-
/**
* Creates a reconnecting client.
*
* @return Future representing the reconnection task. It will report completion based on reestablishStrategy, e.g.
* success is never reported, only failure when it runs out of reconnection attempts.
*/
- protected Future<Void> createReconnectingClient(final InetSocketAddress address,
+ protected ReconnectFuture createReconnectingClient(final InetSocketAddress address,
final ReconnectStrategyFactory connectStrategyFactory, final PipelineInitializer<S> initializer) {
final Bootstrap b = new Bootstrap();
bootstrap.group(workerGroup);
}
}
-
- @Deprecated
- @Override
- public void close() {
- }
}