org.xnio.XnioWorker Java Examples

The following examples show how to use org.xnio.XnioWorker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProgrammaticWebSocketServer.java    From wildfly-samples with MIT License 9 votes vote down vote up
public ProgrammaticWebSocketServer() throws IOException {
    final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader());
    final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap());

    WebSocketDeploymentInfo websocket = new WebSocketDeploymentInfo()
            .addEndpoint(MyAnnotatedEndpoint.class)
            .setWorker(xnioWorker);

    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(MyAnnotatedEndpoint.class.getClassLoader())
            .setContextPath("/myapp")
            .setDeploymentName("websockets")
            .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, websocket);

    manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();
}
 
Example #2
Source File: AnnotatedWebSocketServer.java    From wildfly-samples with MIT License 7 votes vote down vote up
public AnnotatedWebSocketServer() throws IOException {
    final Xnio xnio = Xnio.getInstance("nio", Undertow.class.getClassLoader());
    final XnioWorker xnioWorker = xnio.createWorker(OptionMap.builder().getMap());

    WebSocketDeploymentInfo websocket = new WebSocketDeploymentInfo()
            .addEndpoint(MyAnnotatedEndpoint.class)
            .setWorker(xnioWorker);

    DeploymentInfo deploymentInfo = deployment()
            .setClassLoader(MyAnnotatedEndpoint.class.getClassLoader())
            .setContextPath("/myapp")
            .setDeploymentName("websockets")
            .addServletContextAttribute(WebSocketDeploymentInfo.ATTRIBUTE_NAME, websocket);

    manager = defaultContainer().addDeployment(deploymentInfo);
    manager.deploy();
}
 
Example #3
Source File: IOSubsystem20TestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(String.valueOf(mainServices.getBootError()));
    }
    ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    XnioWorker worker = workerServiceController.getService().getValue();
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
    PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
    ModelNode op = Util.createOperation("read-resource", addr);
    op.get("include-runtime").set(true);
    mainServices.executeOperation(op);
}
 
Example #4
Source File: UndertowClient.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public IoFuture<ClientConnection> connect(InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) {
    ClientProvider provider = getClientProvider(uri);
    final FutureResult<ClientConnection> result = new FutureResult<>();
    provider.connect(new ClientCallback<ClientConnection>() {
        @Override
        public void completed(ClientConnection r) {
            result.setResult(r);
        }

        @Override
        public void failed(IOException e) {
            result.setException(e);
        }
    }, bindAddress, uri, worker, ssl, bufferPool, options);
    return result.getIoFuture();
}
 
Example #5
Source File: HttpClientProvider.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void connect(ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, URI uri, XnioWorker worker, XnioSsl ssl, ByteBufferPool bufferPool, OptionMap options) {
    if (uri.getScheme().equals("https")) {
        if (ssl == null) {
            listener.failed(UndertowMessages.MESSAGES.sslWasNull());
            return;
        }
        OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap();
        if (bindAddress == null) {
            ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null);
        } else {
            ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, bufferPool, tlsOptions, uri), tlsOptions).addNotifier(createNotifier(listener), null);
        }
    } else {
        if (bindAddress == null) {
            worker.openStreamConnection(new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), options).addNotifier(createNotifier(listener), null);
        } else {
            worker.openStreamConnection(bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 80 : uri.getPort()), createOpenListener(listener, bufferPool, options, uri), null, options).addNotifier(createNotifier(listener), null);
        }
    }
}
 
Example #6
Source File: IOSubsystem11TestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServicesBuilder builder = createKernelServicesBuilder(createAdditionalInitialization())
            .setSubsystemXml(getSubsystemXml());
    KernelServices mainServices = builder.build();
    if (!mainServices.isSuccessfulBoot()) {
        Assert.fail(mainServices.getBootError().toString());
    }
    ServiceController<XnioWorker> workerServiceController = (ServiceController<XnioWorker>) mainServices.getContainer().getService(IOServices.WORKER.append("default"));
    workerServiceController.setMode(ServiceController.Mode.ACTIVE);
    workerServiceController.awaitValue();
    XnioWorker worker = workerServiceController.getService().getValue();
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
    PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
    ModelNode op = Util.createOperation("read-resource", addr);
    op.get("include-runtime").set(true);
    mainServices.executeOperation(op);
}
 
Example #7
Source File: IOSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testRuntime() throws Exception {
    KernelServices mainServices = startKernelServices(getSubsystemXml());
    XnioWorker worker = startXnioWorker(mainServices);
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 2, worker.getIoThreadCount());
    Assert.assertEquals(ProcessorInfo.availableProcessors() * 16, worker.getOption(Options.WORKER_TASK_MAX_THREADS).intValue());
    PathAddress addr = PathAddress.parseCLIStyleAddress("/subsystem=io/worker=default");
    ModelNode op = Util.createOperation("read-resource", addr);
    op.get("include-runtime").set(true);
    mainServices.executeOperation(op);
}
 
Example #8
Source File: UndertowXhrTransport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
public UndertowXnioBufferSupport() {
	this.xnioBufferPool = new org.xnio.ByteBufferSlicePool(1048, 1048);
	this.httpClientConnectCallbackMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			ClientCallback.class, URI.class, XnioWorker.class, Pool.class, OptionMap.class);
	this.httpClientConnectMethod = ReflectionUtils.findMethod(UndertowClient.class, "connect",
			URI.class, XnioWorker.class, Pool.class, OptionMap.class);
}
 
Example #9
Source File: ModClusterProxyServer.java    From quarkus-http with Apache License 2.0 5 votes vote down vote up
public static void main(final String[] args) throws IOException {
    final XnioWorker worker = Xnio.getInstance().createWorker(OptionMap.EMPTY);
    final Undertow server;

    final ModCluster modCluster = ModCluster.builder(worker).build();
    try {
        if (chost == null) {
            // We are going to guess it.
            chost = java.net.InetAddress.getLocalHost().getHostName();
            System.out.println("Using: " + chost + ":" + cport);
        }

        modCluster.start();

        // Create the proxy and mgmt handler
        final HttpHandler proxy = modCluster.createProxyHandler();
        final MCMPConfig config = MCMPConfig.webBuilder()
                .setManagementHost(chost)
                .setManagementPort(cport)
                .enableAdvertise()
                .getParent()
                .build();

        final HttpHandler mcmp = config.create(modCluster, proxy);

        server = Undertow.builder()
                .addHttpListener(cport, chost)
                .addHttpListener(pport, phost)
                .setHandler(mcmp)
                .build();
        server.start();

        // Start advertising the mcmp handler
        modCluster.advertise(config);

    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #10
Source File: RemotingServices.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void installRemotingManagementEndpoint(final ServiceTarget serviceTarget, final ServiceName endpointName,
                                                     final String hostName, final EndpointService.EndpointType type, final OptionMap options) {
    final ServiceBuilder<?> builder = serviceTarget.addService(endpointName);
    final Consumer<Endpoint> endpointConsumer = builder.provides(endpointName);
    final Supplier<XnioWorker> workerSupplier = builder.requires(ServiceName.JBOSS.append("serverManagement", "controller", "management", "worker"));
    builder.setInstance(new EndpointService(endpointConsumer, workerSupplier, hostName, type, options));
    builder.install();
}
 
Example #11
Source File: WorkerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void revertUpdateToRuntime(OperationContext context, ModelNode operation, String attributeName, ModelNode valueToRestore, ModelNode valueToRevert, Object handback) throws OperationFailedException {
    XnioWorker worker = getXnioWorker(context);
    if (worker == null) { //worker can be null if it is not started yet, it can happen when there are no dependencies to it.
        return;
    }
    try {
        setValue(worker, valueToRestore);
    } catch (IOException e) {
        throw new OperationFailedException(e);
    }
}
 
Example #12
Source File: UndertowWebSocketClient.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Alternate constructor providing additional control over the
 * {@link ConnectionBuilder} for each WebSocket connection.
 * @param worker the Xnio worker to use to create {@code ConnectionBuilder}'s
 * @param byteBufferPool the ByteBufferPool to use to create {@code ConnectionBuilder}'s
 * @param builderConsumer a consumer to configure {@code ConnectionBuilder}'s
 * @since 5.0.8
 */
public UndertowWebSocketClient(XnioWorker worker, ByteBufferPool byteBufferPool,
		Consumer<ConnectionBuilder> builderConsumer) {

	Assert.notNull(worker, "XnioWorker must not be null");
	Assert.notNull(byteBufferPool, "ByteBufferPool must not be null");
	this.worker = worker;
	this.byteBufferPool = byteBufferPool;
	this.builderConsumer = builderConsumer;
}
 
Example #13
Source File: ManagementHttpServer.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private ManagementHttpServer(HttpOpenListener openListener, InetSocketAddress httpAddress, InetSocketAddress secureAddress, SSLContext sslContext,
                             SslClientAuthMode sslClientAuthMode, XnioWorker worker, HttpAuthenticationFactory httpAuthenticationFactory, SecurityRealm securityRealm, ExtensionHandlers extensionExtensionHandlers) {
    this.openListener = openListener;
    this.httpAddress = httpAddress;
    this.secureAddress = secureAddress;
    this.sslContext = sslContext;
    this.sslClientAuthMode = sslClientAuthMode;
    this.worker = worker;
    this.httpAuthenticationFactory = httpAuthenticationFactory;
    this.securityRealm = securityRealm;
    this.extensionHandlers = extensionExtensionHandlers;
}
 
Example #14
Source File: InMemorySessionManager.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private SessionImpl(final InMemorySessionManager sessionManager, final String sessionId, final SessionConfig sessionCookieConfig, final XnioIoThread executor, final XnioWorker worker, final Object evictionToken, final int maxInactiveInterval) {
    this.sessionManager = sessionManager;
    this.sessionId = sessionId;
    this.sessionCookieConfig = sessionCookieConfig;
    this.executor = executor;
    this.worker = worker;
    this.evictionToken = evictionToken;
    creationTime = lastAccessed = System.currentTimeMillis();
    this.maxInactiveInterval = maxInactiveInterval;
}
 
Example #15
Source File: DeploymentManagerFactory.java    From seed with Mozilla Public License 2.0 5 votes vote down vote up
DeploymentManagerFactory(XnioWorker xnioWorker, Coffig configuration, Map<String, String> initParameters) {
    this.xnioWorker = xnioWorker;
    this.undertowConfig = configuration.get(UndertowConfig.class);
    this.applicationConfig = configuration.get(ApplicationConfig.class);
    this.serverConfig = configuration.get(WebConfig.ServerConfig.class);
    this.initParameters = initParameters;
}
 
Example #16
Source File: RemotingSubsystemAdd.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
protected void performRuntime(OperationContext context, ModelNode operation, Resource resource) throws OperationFailedException {

    // WFCORE-4510 -- the effective endpoint configuration is from the root subsystem resource,
    // not from the placeholder configuration=endpoint child resource.
    ModelNode endpointModel = resource.getModel();
    String workerName = WORKER.resolveModelAttribute(context, endpointModel).asString();

    final OptionMap map = EndpointConfigFactory.populate(context, endpointModel);

    // create endpoint
    final String nodeName = WildFlySecurityManager.getPropertyPrivileged(RemotingExtension.NODE_NAME_PROPERTY, null);

    // In case of a managed server the subsystem endpoint might already be installed {@see DomainServerCommunicationServices}
    if (context.getProcessType() == ProcessType.DOMAIN_SERVER) {
        final ServiceController<?> controller = context.getServiceRegistry(false).getService(RemotingServices.SUBSYSTEM_ENDPOINT);
        if (controller != null) {
            // if installed, just skip the rest
            return;
        }
    }

    final CapabilityServiceBuilder<?> builder = context.getCapabilityServiceTarget().addCapability(REMOTING_ENDPOINT_CAPABILITY);
    final Consumer<Endpoint> endpointConsumer = builder.provides(REMOTING_ENDPOINT_CAPABILITY);
    final Supplier<XnioWorker> workerSupplier = builder.requiresCapability(IO_WORKER_CAPABILITY_NAME, XnioWorker.class, workerName);
    builder.setInstance(new EndpointService(endpointConsumer, workerSupplier, nodeName, EndpointService.EndpointType.SUBSYSTEM, map));
    builder.install();
}
 
Example #17
Source File: RemotingLegacySubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private AdditionalInitialization createRuntimeAdditionalInitialization(final boolean legacyParser) {
    return new AdditionalInitialization() {
        @Override
        protected void setupController(ControllerInitializer controllerInitializer) {
            controllerInitializer.addSocketBinding("test", 27258);
            controllerInitializer.addRemoteOutboundSocketBinding("dummy-outbound-socket", "localhost", 6799);
            controllerInitializer.addRemoteOutboundSocketBinding("other-outbound-socket", "localhost", 1234);
        }

        @Override
        protected void addExtraServices(ServiceTarget target) {
            //Needed for initialization of the RealmAuthenticationProviderService
            AbsolutePathService.addService(ServerEnvironment.CONTROLLER_TEMP_DIR, new File("target/temp" + System.currentTimeMillis()).getAbsolutePath(), target);
            if (!legacyParser) {
                ServiceBuilder<?> builder = target.addService(IOServices.WORKER.append("default"));
                Consumer<XnioWorker> workerConsumer = builder.provides(IOServices.WORKER.append("default"));
                builder.setInstance(new WorkerService(workerConsumer, () -> Executors.newFixedThreadPool(1), Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2)));
                builder.install();                }
        }

        @Override
        protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
            super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry);

            Map<String, Class> capabilities = new HashMap<>();
            capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME,
                    "default-remoting"), XnioWorker.class);

            if (legacyParser) {
                // Deal with the fact that legacy parsers will add the io extension/subsystem
                RemotingSubsystemTestUtil.registerIOExtension(extensionRegistry, rootRegistration);
            } else {
                capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME,
                        RemotingSubsystemRootResource.WORKER.getDefaultValue().asString()), XnioWorker.class);
            }

            AdditionalInitialization.registerServiceCapabilities(capabilityRegistry, capabilities);
        }
    };
}
 
Example #18
Source File: SNICombinedWithALPNTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testSimpleViaHostname() throws Exception {
    Assume.assumeFalse("There is no ALPN implementation in IBM JDK 8 and less; also ALPN-hack that serves" +
                    " as a workaround for other JDKs does not work with IBM JDK.", isIbmJdk() && jdkLessThan9());

    XnioSsl ssl = createClientSSL(hostNameKeystore);
    UndertowClient client = UndertowClient.getInstance();
    DefaultByteBufferPool pool = new DefaultByteBufferPool(false, 1024);
    ClientConnection connection = client.connect(new URI("https", null, "localhost", TestSuiteEnvironment.getHttpPort(), "", null, null), XnioWorker.getContextManager().get(), ssl, pool, OptionMap.create(UndertowOptions.ENABLE_HTTP2, true)).get();
    performSimpleTest(pool, connection);
}
 
Example #19
Source File: WorkerResourceDefinition.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
void executeWithWorker(OperationContext context, ModelNode operation, XnioWorker worker) throws OperationFailedException {
    try {
        Object result = worker.getOption(option);
        if (result!=null){
            context.getResult().set(new ModelNode(result.toString()));
        }
    } catch (IOException e) {
        throw new OperationFailedException(e);
    }
}
 
Example #20
Source File: EndpointService.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
public EndpointService(final Consumer<Endpoint> endpointConsumer, final Supplier<XnioWorker> workerSupplier, String nodeName, EndpointType type, final OptionMap optionMap) {
    this.endpointConsumer = endpointConsumer;
    this.workerSupplier = workerSupplier;
    if (nodeName == null) {
        nodeName = "remote";
    }
    endpointName = type == EndpointType.SUBSYSTEM ? nodeName : nodeName + ":" + type;
    this.optionMap = optionMap;
}
 
Example #21
Source File: NodePingUtil.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Try to open a socket connection to given address.
 *
 * @param address     the socket address
 * @param exchange    the http servers exchange
 * @param callback    the ping callback
 * @param options     the options
 */
static void pingHost(InetSocketAddress address, HttpServerExchange exchange, PingCallback callback, OptionMap options) {

    final XnioIoThread thread = exchange.getIoThread();
    final XnioWorker worker = thread.getWorker();
    final HostPingTask r = new HostPingTask(address, worker, callback, options);
    // Schedule timeout task
    scheduleCancelTask(exchange.getIoThread(), r, 5, TimeUnit.SECONDS);
    exchange.dispatch(exchange.isInIoThread() ? SameThreadExecutor.INSTANCE : thread, r);
}
 
Example #22
Source File: RemotingSubsystemTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private AdditionalInitialization createRuntimeAdditionalInitialization() {
    return new AdditionalInitialization() {
        @Override
        protected void setupController(ControllerInitializer controllerInitializer) {
            controllerInitializer.addSocketBinding("remoting", 27258);
            controllerInitializer.addRemoteOutboundSocketBinding("dummy-outbound-socket", "localhost", 6799);
            controllerInitializer.addRemoteOutboundSocketBinding("other-outbound-socket", "localhost", 1234);
        }

        @Override
        protected void addExtraServices(ServiceTarget target) {
            //Needed for initialization of the RealmAuthenticationProviderService
            AbsolutePathService.addService(ServerEnvironment.CONTROLLER_TEMP_DIR, new File("target/temp" + System.currentTimeMillis()).getAbsolutePath(), target);
            ServiceBuilder<?> builder = target.addService(IOServices.WORKER.append("default"));
            Consumer<XnioWorker> workerConsumer = builder.provides(IOServices.WORKER.append("default"));
            builder.setInstance(new WorkerService(workerConsumer, () -> Executors.newFixedThreadPool(1), Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2)));
            builder.setInitialMode(ServiceController.Mode.ON_DEMAND);
            builder.install();

            builder = target.addService(IOServices.WORKER.append("default-remoting"));
            workerConsumer = builder.provides(IOServices.WORKER.append("default-remoting"));
            builder.setInstance(new WorkerService(workerConsumer, () -> Executors.newFixedThreadPool(1), Xnio.getInstance().createWorkerBuilder().setWorkerIoThreads(2)));
            builder.setInitialMode(ServiceController.Mode.ON_DEMAND);
            builder.install();            }

        @Override
        protected void initializeExtraSubystemsAndModel(ExtensionRegistry extensionRegistry, Resource rootResource, ManagementResourceRegistration rootRegistration, RuntimeCapabilityRegistry capabilityRegistry) {
            super.initializeExtraSubystemsAndModel(extensionRegistry, rootResource, rootRegistration, capabilityRegistry);
            Map<String, Class> capabilities = new HashMap<>();
            capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME,
                    RemotingSubsystemRootResource.WORKER.getDefaultValue().asString()), XnioWorker.class);
            capabilities.put(buildDynamicCapabilityName(IO_WORKER_CAPABILITY_NAME,
                    "default-remoting"), XnioWorker.class);
            AdditionalInitialization.registerServiceCapabilities(capabilityRegistry, capabilities);
        }
    };
}
 
Example #23
Source File: OutboundBindAddressUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
static WorkerService getWorkerService(final OperationContext context) {
    final ServiceRegistry serviceRegistry = context.getServiceRegistry(false);
    final String workerName = context.getCurrentAddress().getParent().getLastElement().getValue();
    final ServiceName workerServiceName = WorkerResourceDefinition.IO_WORKER_RUNTIME_CAPABILITY.getCapabilityServiceName(workerName, XnioWorker.class);
    final ServiceController<?> workerServiceController = serviceRegistry.getRequiredService(workerServiceName);
    return (WorkerService) workerServiceController.getService();
}
 
Example #24
Source File: Http2ClientProvider.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void connect(final ClientCallback<ClientConnection> listener, InetSocketAddress bindAddress, final URI uri, final XnioWorker worker, final XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap options) {
    if (ssl == null) {
        listener.failed(UndertowMessages.MESSAGES.sslWasNull());
        return;
    }
    OptionMap tlsOptions = OptionMap.builder().addAll(options).set(Options.SSL_STARTTLS, true).getMap();
    if(bindAddress == null) {
        ssl.openSslConnection(worker, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, tlsOptions), tlsOptions).addNotifier(createNotifier(listener), null);
    } else {
        ssl.openSslConnection(worker, bindAddress, new InetSocketAddress(uri.getHost(), uri.getPort() == -1 ? 443 : uri.getPort()), createOpenListener(listener, uri, ssl, bufferPool, tlsOptions), tlsOptions).addNotifier(createNotifier(listener), null);
    }

}
 
Example #25
Source File: AbstractFramedStreamSourceChannel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public XnioWorker getWorker() {
    return framedChannel.getWorker();
}
 
Example #26
Source File: NodePingUtil.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
HostPingTask(InetSocketAddress address, XnioWorker worker, PingCallback callback, OptionMap options) {
    super(callback);
    this.address = address;
    this.worker = worker;
    this.options = options;
}
 
Example #27
Source File: ModCluster.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public static Builder builder(final XnioWorker worker) {
    return builder(worker, UndertowClient.getInstance(), null);
}
 
Example #28
Source File: AbstractFramedChannel.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public XnioWorker getWorker() {
    return channel.getWorker();
}
 
Example #29
Source File: ModCluster.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public static Builder builder(final XnioWorker worker, final UndertowClient client, final XnioSsl xnioSsl) {
    return new Builder(worker, client, xnioSsl);
}
 
Example #30
Source File: WebSocketClient.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public static IoFuture<WebSocketChannel> connect(XnioWorker worker, XnioSsl ssl, final ByteBufferPool bufferPool, final OptionMap optionMap, final URI uri, WebSocketVersion version, WebSocketClientNegotiation clientNegotiation) {
    return connect(worker, ssl, bufferPool, optionMap, uri, version, clientNegotiation, null);
}