Search in sources :

Example 1 with PCEPDispatcherDependencies

use of org.opendaylight.protocol.pcep.PCEPDispatcherDependencies in project bgpcep by opendaylight.

the class PCEPDispatcherImpl method createServer.

@Override
public final synchronized ChannelFuture createServer(final PCEPDispatcherDependencies dispatcherDependencies) {
    this.keys = dispatcherDependencies.getKeys();
    @SuppressWarnings("unchecked") final ChannelPipelineInitializer initializer = (ch, promise) -> {
        ch.pipeline().addLast(this.hf.getDecoders());
        ch.pipeline().addLast("negotiator", this.snf.getSessionNegotiator(dispatcherDependencies, ch, promise));
        ch.pipeline().addLast(this.hf.getEncoders());
    };
    final ServerBootstrap b = createServerBootstrap(initializer);
    final InetSocketAddress address = dispatcherDependencies.getAddress();
    final ChannelFuture f = b.bind(address);
    LOG.debug("Initiated server {} at {}.", f, address);
    this.keys = KeyMapping.getKeyMapping();
    return f;
}
Also used : EventExecutor(io.netty.util.concurrent.EventExecutor) ChannelOption(io.netty.channel.ChannelOption) LoggerFactory(org.slf4j.LoggerFactory) EpollMode(io.netty.channel.epoll.EpollMode) MessageRegistry(org.opendaylight.protocol.pcep.spi.MessageRegistry) GlobalEventExecutor(io.netty.util.concurrent.GlobalEventExecutor) EpollChannelOption(io.netty.channel.epoll.EpollChannelOption) PCEPSessionNegotiatorFactory(org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory) PCEPDispatcher(org.opendaylight.protocol.pcep.PCEPDispatcher) EpollServerSocketChannel(io.netty.channel.epoll.EpollServerSocketChannel) FixedRecvByteBufAllocator(io.netty.channel.FixedRecvByteBufAllocator) Objects.requireNonNull(java.util.Objects.requireNonNull) EpollEventLoopGroup(io.netty.channel.epoll.EpollEventLoopGroup) SocketChannel(io.netty.channel.socket.SocketChannel) Nonnull(javax.annotation.Nonnull) EventLoopGroup(io.netty.channel.EventLoopGroup) Logger(org.slf4j.Logger) ChannelInitializer(io.netty.channel.ChannelInitializer) Promise(io.netty.util.concurrent.Promise) KeyMapping(org.opendaylight.protocol.concepts.KeyMapping) NioServerSocketChannel(io.netty.channel.socket.nio.NioServerSocketChannel) PooledByteBufAllocator(io.netty.buffer.PooledByteBufAllocator) GuardedBy(javax.annotation.concurrent.GuardedBy) InetSocketAddress(java.net.InetSocketAddress) PCEPDispatcherDependencies(org.opendaylight.protocol.pcep.PCEPDispatcherDependencies) ChannelFuture(io.netty.channel.ChannelFuture) Epoll(io.netty.channel.epoll.Epoll) TimeUnit(java.util.concurrent.TimeUnit) DefaultPromise(io.netty.util.concurrent.DefaultPromise) Closeable(java.io.Closeable) ServerBootstrap(io.netty.bootstrap.ServerBootstrap) ChannelFuture(io.netty.channel.ChannelFuture) InetSocketAddress(java.net.InetSocketAddress) ServerBootstrap(io.netty.bootstrap.ServerBootstrap)

Aggregations

ServerBootstrap (io.netty.bootstrap.ServerBootstrap)1 PooledByteBufAllocator (io.netty.buffer.PooledByteBufAllocator)1 ChannelFuture (io.netty.channel.ChannelFuture)1 ChannelInitializer (io.netty.channel.ChannelInitializer)1 ChannelOption (io.netty.channel.ChannelOption)1 EventLoopGroup (io.netty.channel.EventLoopGroup)1 FixedRecvByteBufAllocator (io.netty.channel.FixedRecvByteBufAllocator)1 Epoll (io.netty.channel.epoll.Epoll)1 EpollChannelOption (io.netty.channel.epoll.EpollChannelOption)1 EpollEventLoopGroup (io.netty.channel.epoll.EpollEventLoopGroup)1 EpollMode (io.netty.channel.epoll.EpollMode)1 EpollServerSocketChannel (io.netty.channel.epoll.EpollServerSocketChannel)1 SocketChannel (io.netty.channel.socket.SocketChannel)1 NioServerSocketChannel (io.netty.channel.socket.nio.NioServerSocketChannel)1 DefaultPromise (io.netty.util.concurrent.DefaultPromise)1 EventExecutor (io.netty.util.concurrent.EventExecutor)1 GlobalEventExecutor (io.netty.util.concurrent.GlobalEventExecutor)1 Promise (io.netty.util.concurrent.Promise)1 Closeable (java.io.Closeable)1 InetSocketAddress (java.net.InetSocketAddress)1