/** * Construct a new XNIO worker. * * @param optionMap the options to use to configure the worker * @return the new worker * @throws IOException if the worker failed to be opened * @throws IllegalArgumentException if an option value is invalid for this worker */ public XnioWorker createWorker(OptionMap optionMap) throws IOException, IllegalArgumentException { return createWorker(null, optionMap); }
/** * Construct a new XNIO worker. * * @param threadGroup the thread group for worker threads * @param optionMap the options to use to configure the worker * @return the new worker * @throws IOException if the worker failed to be opened * @throws IllegalArgumentException if an option value is invalid for this worker */ public XnioWorker createWorker(ThreadGroup threadGroup, OptionMap optionMap) throws IOException, IllegalArgumentException { return createWorker(threadGroup, optionMap, null); }
public UndertowXhrTransport(OptionMap optionMap) throws IOException { Assert.notNull(optionMap, "OptionMap is required"); this.optionMap = optionMap; this.httpClient = UndertowClient.getInstance(); this.worker = Xnio.getInstance().createWorker(optionMap); this.bufferPool = new DefaultByteBufferPool(false, 1024, -1, 2); }
public ConnectionProviderContextImpl ( OptionMap opts, String endpointName ) throws IllegalArgumentException, IOException { this.instance = Xnio.getInstance(); this.worker = this.instance.createWorker(opts); this.endpoint = Remoting.createEndpoint(endpointName, this.worker, opts); this.executor = Executors.newCachedThreadPool(new ThreadFactory() { public Thread newThread ( Runnable r ) { Thread t = new Thread(r, "Worker"); t.setDaemon(true); return t; } }); }
private Http2Client(final ClassLoader classLoader) { ServiceLoader<ClientProvider> providers = ServiceLoader.load(ClientProvider.class, classLoader); final Map<String, ClientProvider> map = new HashMap<>(); for (ClientProvider provider : providers) { for (String scheme : provider.handlesSchemes()) { map.put(scheme, provider); } } this.clientProviders = Collections.unmodifiableMap(map); try { final Xnio xnio = Xnio.getInstance(); WORKER = xnio.createWorker(null, Http2Client.DEFAULT_OPTIONS); SSL = new UndertowXnioSsl(WORKER.getXnio(), OptionMap.EMPTY, BUFFER_POOL, createSSLContext()); } catch (Exception e) { logger.error("Exception: ", e); } }
private XnioWorker createWorker() throws IOException { Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader()); return xnio.createWorker( OptionMap.builder().set(Options.THREAD_DAEMON, true).getMap()); }
private XnioWorker createWorker() throws IOException { Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader()); return xnio.createWorker( OptionMap.builder().set(Options.THREAD_DAEMON, true).getMap()); }
final XnioWorker xnioWorker = xnio.createWorker(null, modifiedOptionMap, new Runnable() { public void run() { final Endpoint endpoint = endpointRef.getAndSet(null);
@Parameters(name = "client[{0}] - server [{1}]") public static Object[][] arguments() throws IOException { WebSocketClient[] clients = new WebSocketClient[] { new TomcatWebSocketClient(), new JettyWebSocketClient(), new ReactorNettyWebSocketClient(), new UndertowWebSocketClient(Xnio.getInstance().createWorker(OptionMap.EMPTY)) }; Map<HttpServer, Class<?>> servers = new LinkedHashMap<>(); servers.put(new TomcatHttpServer(TMP_DIR.getAbsolutePath(), WsContextListener.class), TomcatConfig.class); servers.put(new JettyHttpServer(), JettyConfig.class); servers.put(new ReactorHttpServer(), ReactorNettyConfig.class); servers.put(new UndertowHttpServer(), UndertowConfig.class); Flux<WebSocketClient> f1 = Flux.fromArray(clients).concatMap(c -> Flux.just(c).repeat(servers.size())); Flux<HttpServer> f2 = Flux.fromIterable(servers.keySet()).repeat(clients.length); Flux<Class<?>> f3 = Flux.fromIterable(servers.values()).repeat(clients.length); return Flux.zip(f1, f2, f3).map(Tuple3::toArray).collectList().block() .toArray(new Object[clients.length * servers.size()][2]); }
info.setWorker(Xnio.getInstance().createWorker(OptionMap.EMPTY)); info.setBuffers(new org.xnio.ByteBufferSlicePool(1024,1024));
try { if (internalWorker) { worker = xnio.createWorker(OptionMap.builder() .set(Options.WORKER_IO_THREADS, ioThreads) .set(Options.CONNECTION_HIGH_WATER, 1000000)
/** * Construct a new XNIO worker. * * @param optionMap the options to use to configure the worker * @return the new worker * @throws IOException if the worker failed to be opened * @throws IllegalArgumentException if an option value is invalid for this worker */ public XnioWorker createWorker(OptionMap optionMap) throws IOException, IllegalArgumentException { return createWorker(null, optionMap); }
/** * Construct a new XNIO worker. * * @param threadGroup the thread group for worker threads * @param optionMap the options to use to configure the worker * @return the new worker * @throws IOException if the worker failed to be opened * @throws IllegalArgumentException if an option value is invalid for this worker */ public XnioWorker createWorker(ThreadGroup threadGroup, OptionMap optionMap) throws IOException, IllegalArgumentException { return createWorker(threadGroup, optionMap, null); }
private static XnioWorker createWorkers() { try { return Xnio.getInstance().createWorker(options); } catch (IOException e) { throw new IllegalStateException(e); } }
static XnioWorker getWorker() { if (worker == null) { try { worker = Xnio.getInstance().createWorker(DEFAULT.getMap()); } catch (Exception e) { throw new RuntimeException("Could not build client worker", e); } } return worker; }
@Override public void start(StartContext startContext) throws StartException { final Xnio xnio = Xnio.getInstance(); try { worker = xnio.createWorker(null, options, this::stopDone); } catch (IOException e) { throw new StartException(e); } }
/** * Create a new {@link XnioEventLoopGroup} which creates a new {@link XnioWorker} by itself and use it for all * operations. Using the given number of Threads to handle the IO. * * @throws IOException */ public XnioEventLoopGroup(int numThreads) throws IOException { this(Xnio.getInstance().createWorker(OptionMap.create(Options.WORKER_IO_THREADS, numThreads))); }
public UndertowXhrTransport(OptionMap optionMap) throws IOException { Assert.notNull(optionMap, "OptionMap is required"); this.optionMap = optionMap; this.httpClient = UndertowClient.getInstance(); this.worker = Xnio.getInstance().createWorker(optionMap); this.bufferPool = new DefaultByteBufferPool(false, 1024, -1, 2); }
private UndertowClientWrapper() throws IOException, URISyntaxException { this.worker = Xnio.getInstance().createWorker(OptionMap.EMPTY); this.pool = new DefaultByteBufferPool(true, 17 * 1024); this.client = UndertowClient.getInstance(); }
static EndpointImpl construct(final Xnio xnio, final String name, final OptionMap optionMap) throws IOException { final HoldingRunnable holdingRunnable = new HoldingRunnable(); final XnioWorker xnioWorker = xnio.createWorker(null, OptionMap.builder().addAll(optionMap).set(Options.WORKER_NAME, name == null ? "Remoting (anonymous)" : "Remoting \"" + name + "\"").getMap(), holdingRunnable); return new EndpointImpl(xnio, xnioWorker, name, optionMap, holdingRunnable); }