All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.client.hotrod.TransportFactory Maven / Gradle / Ivy

The newest version!
package org.infinispan.client.hotrod;

import java.util.concurrent.ExecutorService;

import org.infinispan.client.hotrod.impl.transport.netty.DefaultTransportFactory;
import org.infinispan.client.hotrod.impl.transport.netty.NativeTransport;

import io.netty.channel.EventLoopGroup;
import io.netty.channel.socket.DatagramChannel;
import io.netty.channel.socket.SocketChannel;

/**
 * TransportFactory is responsible for creating Netty's {@link SocketChannel}s and {@link EventLoopGroup}s.
 *
 * @author Tristan Tarrant <[email protected]>
 * @since 12.1
 **/
public interface TransportFactory {
   TransportFactory DEFAULT = new DefaultTransportFactory();

   /**
    * Returns the Netty {@link SocketChannel} class to use in the transport.
    */
   Class socketChannelClass();

   /**
    * Returns the Netty {@link DatagramChannel} class to use for DNS resolution.
    */
   default Class datagramChannelClass() {
      return NativeTransport.datagramChannelClass();
   }

   /**
    * Creates an event loop group
    *
    * @param maxExecutors the maximum number of executors
    * @param executorService the executor service to use
    * @return an instance of Netty's {@link EventLoopGroup}
    */
   EventLoopGroup createEventLoopGroup(int maxExecutors, ExecutorService executorService);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy