Tabnine Logo
Transport
Code IndexAdd Tabnine to your IDE (free)

How to use
Transport
in
io.vertx.core.net.impl.transport

Best Java code snippets using io.vertx.core.net.impl.transport.Transport (Showing top 20 results out of 315)

origin: eclipse-vertx/vert.x

public static AsyncResolveConnectHelper doBind(VertxInternal vertx, SocketAddress socketAddress,
                        ServerBootstrap bootstrap) {
 AsyncResolveConnectHelper asyncResolveConnectHelper = new AsyncResolveConnectHelper();
 bootstrap.channelFactory(vertx.transport().serverChannelFactory(socketAddress.path() != null));
 if (socketAddress.path() != null) {
  java.net.SocketAddress converted = vertx.transport().convert(socketAddress, true);
  ChannelFuture future = bootstrap.bind(converted);
  future.addListener(f -> {
origin: eclipse-vertx/vert.x

public static Transport transport(boolean preferNative) {
 if (preferNative) {
  Transport nativeTransport = Transport.nativeTransport();
  if (nativeTransport != null && nativeTransport.isAvailable()) {
   return nativeTransport;
  } else {
   return Transport.JDK;
  }
 } else {
  return Transport.JDK;
 }
}
origin: eclipse-vertx/vert.x

@Override
public void configure(NetServerOptions options, boolean domainSocket, ServerBootstrap bootstrap) {
 if (!domainSocket) {
  bootstrap.option(KQueueChannelOption.SO_REUSEPORT, options.isReusePort());
 }
 super.configure(options, domainSocket, bootstrap);
}
origin: eclipse-vertx/vert.x

Bootstrap bootstrap = new Bootstrap();
bootstrap.group(context.nettyEventLoop());
bootstrap.channelFactory(vertx.transport().channelFactory(remoteAddress.path() != null));
origin: eclipse-vertx/vert.x

ServerBootstrap bs = new ServerBootstrap();
bs.group(context.nettyEventLoop());
bs.channelFactory(((VertxInternal)vertx).transport().serverChannelFactory(false)) ;
bs.option(ChannelOption.SO_BACKLOG, 100);
bs.childHandler(new ChannelInitializer<SocketChannel>() {
origin: eclipse-vertx/vert.x

private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) {
 Transport transport = vertx.transport();
 DatagramChannel channel = transport.datagramChannel(options.isIpV6() ? InternetProtocolFamily.IPv6 : InternetProtocolFamily.IPv4);
 transport.configure(channel, new DatagramSocketOptions(options));
 ContextInternal context = vertx.getOrCreateContext();
 channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true);
 MaxMessagesRecvByteBufAllocator bufAllocator = channel.config().getRecvByteBufAllocator();
 bufAllocator.maxMessagesPerRead(1);
 context.nettyEventLoop().register(channel);
 if (options.getLogActivity()) {
  channel.pipeline().addLast("logging", new LoggingHandler());
 }
 VertxMetrics metrics = vertx.metricsSPI();
 this.metrics = metrics != null ? metrics.createDatagramSocketMetrics(options) : null;
 this.channel = channel;
 this.context = context;
 this.demand = Long.MAX_VALUE;
}
origin: eclipse-vertx/vert.x

/**
 * The native transport, it may be {@code null} or failed.
 */
public static Transport nativeTransport() {
 Transport transport = null;
 try {
  Transport epoll = new EpollTransport();
  if (epoll.isAvailable()) {
   return epoll;
  } else {
   transport = epoll;
  }
 } catch (Throwable ignore) {
  // Jar not here
 }
 try {
  Transport kqueue = new KQueueTransport();
  if (kqueue.isAvailable()) {
   return kqueue;
  } else if (transport == null) {
   transport = kqueue;
  }
 } catch (Throwable ignore) {
  // Jar not here
 }
 return transport;
}
origin: eclipse-vertx/vert.x

static VertxImpl vertx(VertxOptions options) {
 VertxImpl vertx = new VertxImpl(options, Transport.transport(options.getPreferNativeTransport()));
 vertx.init();
 return vertx;
}
origin: eclipse-vertx/vert.x

private void handleConnect(SocketAddress remoteAddress, SocketAddress peerAddress, String serverName, Handler<AsyncResult<Channel>> channelHandler) {
 VertxInternal vertx = context.owner();
 bootstrap.resolver(vertx.nettyAddressResolverGroup());
 bootstrap.handler(new ChannelInitializer<Channel>() {
  @Override
  protected void initChannel(Channel ch) {
   initSSL(peerAddress, serverName, ch, channelHandler);
  }
 });
 ChannelFuture fut = bootstrap.connect(vertx.transport().convert(remoteAddress, false));
 fut.addListener(res -> {
  if (res.isSuccess()) {
   connected(fut.channel(), channelHandler);
  } else {
   channelHandler.handle(io.vertx.core.Future.failedFuture(res.cause()));
  }
 });
}
origin: eclipse-vertx/vert.x

@Override
protected io.netty.resolver.AddressResolver<InetSocketAddress> newResolver(EventExecutor executor) throws Exception {
 ChannelFactory<DatagramChannel> channelFactory = () -> vertx.transport().datagramChannel();
 DnsAddressResolverGroup group = new DnsAddressResolverGroup(channelFactory, nameServerAddressProvider) {
  @Override
origin: eclipse-vertx/vert.x

checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit());
eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
ThreadFactory acceptorEventLoopThreadFactory = new VertxThreadFactory("vert.x-acceptor-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
acceptorEventLoopGroup = transport.eventLoopGroup(1, acceptorEventLoopThreadFactory, 100);
origin: eclipse-vertx/vert.x

bootstrap.channelFactory(client.getVertx().transport().channelFactory(false));
origin: io.vertx/vertx-core

ServerBootstrap bs = new ServerBootstrap();
bs.group(context.nettyEventLoop());
bs.channelFactory(((VertxInternal)vertx).transport().serverChannelFactory(false)) ;
bs.option(ChannelOption.SO_BACKLOG, 100);
bs.childHandler(new ChannelInitializer<SocketChannel>() {
origin: io.vertx/vertx-core

private DatagramSocketImpl(VertxInternal vertx, DatagramSocketOptions options) {
 Transport transport = vertx.transport();
 DatagramChannel channel = transport.datagramChannel(options.isIpV6() ? InternetProtocolFamily.IPv6 : InternetProtocolFamily.IPv4);
 transport.configure(channel, new DatagramSocketOptions(options));
 ContextInternal context = vertx.getOrCreateContext();
 if (context.isMultiThreadedWorkerContext()) {
  throw new IllegalStateException("Cannot use DatagramSocket in a multi-threaded worker verticle");
 }
 channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true);
 MaxMessagesRecvByteBufAllocator bufAllocator = channel.config().getRecvByteBufAllocator();
 bufAllocator.maxMessagesPerRead(1);
 context.nettyEventLoop().register(channel);
 if (options.getLogActivity()) {
  channel.pipeline().addLast("logging", new LoggingHandler());
 }
 VertxMetrics metrics = vertx.metricsSPI();
 this.metrics = metrics != null ? metrics.createDatagramSocketMetrics(options) : null;
 this.channel = channel;
 this.context = context;
 this.demand = Long.MAX_VALUE;
}
origin: io.vertx/vertx-core

/**
 * The native transport, it may be {@code null} or failed.
 */
public static Transport nativeTransport() {
 Transport transport = null;
 try {
  Transport epoll = new EpollTransport();
  if (epoll.isAvailable()) {
   return epoll;
  } else {
   transport = epoll;
  }
 } catch (Throwable ignore) {
  // Jar not here
 }
 try {
  Transport kqueue = new KQueueTransport();
  if (kqueue.isAvailable()) {
   return kqueue;
  } else if (transport == null) {
   transport = kqueue;
  }
 } catch (Throwable ignore) {
  // Jar not here
 }
 return transport;
}
origin: eclipse-vertx/vert.x

static void clusteredVertx(VertxOptions options, Handler<AsyncResult<Vertx>> resultHandler) {
 VertxImpl vertx = new VertxImpl(options, Transport.transport(options.getPreferNativeTransport()));
 vertx.joinCluster(options, resultHandler);
}
origin: eclipse-vertx/vert.x

java.net.SocketAddress targetAddress = vertx.transport().convert(remoteAddress, false);
origin: eclipse-vertx/vert.x

channel = transport.datagramChannel(this.dnsServer.getAddress() instanceof Inet4Address ? InternetProtocolFamily.IPv4 : InternetProtocolFamily.IPv6);
channel.config().setOption(ChannelOption.DATAGRAM_CHANNEL_ACTIVE_ON_REGISTRATION, true);
MaxMessagesRecvByteBufAllocator bufAllocator = channel.config().getRecvByteBufAllocator();
origin: io.vertx/vertx-core

checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit());
eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
ThreadFactory acceptorEventLoopThreadFactory = new VertxThreadFactory("vert.x-acceptor-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit());
acceptorEventLoopGroup = transport.eventLoopGroup(1, acceptorEventLoopThreadFactory, 100);
origin: eclipse-vertx/vert.x

CountDownLatch connectLatch = new CountDownLatch(1);
Bootstrap bootstrap = new Bootstrap();
bootstrap.channelFactory(((VertxInternal)vertx).transport().channelFactory(false));
bootstrap.group(vertx.nettyEventLoopGroup());
bootstrap.resolver(((VertxInternal) vertx).nettyAddressResolverGroup());
io.vertx.core.net.impl.transportTransport

Javadoc

The transport used by a io.vertx.core.Vertx instance.

Most used methods

  • channelFactory
  • serverChannelFactory
  • isAvailable
  • nativeTransport
    The native transport, it may be null or failed.
  • configure
  • convert
  • datagramChannel
  • eventLoopGroup
  • transport

Popular in Java

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • onRequestPermissionsResult (Fragment)
  • compareTo (BigDecimal)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now