Java Code Examples for org.xnio.OptionMap#EMPTY

The following examples show how to use org.xnio.OptionMap#EMPTY . 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: ManagementRemotingServices.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Set up the services to create a channel listener and operation handler service.
 * @param serviceTarget the service target to install the services into
 * @param endpointName the endpoint name to install the services into
 * @param channelName the name of the channel
 * @param executorServiceName service name of the executor service to use in the operation handler service
 * @param scheduledExecutorServiceName  service name of the scheduled executor service to use in the operation handler service
 */
public static void installManagementChannelServices(
        final ServiceTarget serviceTarget,
        final ServiceName endpointName,
        final ModelControllerOperationHandlerFactory operationHandlerServiceFactory,
        final ServiceName modelControllerName,
        final String channelName,
        final ServiceName executorServiceName,
        final ServiceName scheduledExecutorServiceName) {
    final OptionMap options = OptionMap.EMPTY;
    final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX);
    final ServiceBuilder<?> builder = serviceTarget.addService(operationHandlerName);
    final Consumer<AbstractModelControllerOperationHandlerFactoryService> serviceConsumer = builder.provides(operationHandlerName);
    final Supplier<ModelController> mcSupplier = builder.requires(modelControllerName);
    final Supplier<ExecutorService> eSupplier = builder.requires(executorServiceName);
    final Supplier<ScheduledExecutorService> seSupplier = builder.requires(scheduledExecutorServiceName);
    builder.setInstance(operationHandlerServiceFactory.newInstance(serviceConsumer, mcSupplier, eSupplier, seSupplier));
    builder.install();

    installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, false);
}
 
Example 2
Source File: Undertow.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ListenerConfig(final ListenerType type, final int port, final String host, KeyManager[] keyManagers, TrustManager[] trustManagers, HttpHandler rootHandler) {
    this.type = type;
    this.port = port;
    this.host = host;
    this.keyManagers = keyManagers;
    this.trustManagers = trustManagers;
    this.rootHandler = rootHandler;
    this.sslContext = null;
    this.overrideSocketOptions = OptionMap.EMPTY;
    this.useProxyProtocol = false;
}
 
Example 3
Source File: Undertow.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private ListenerConfig(final ListenerType type, final int port, final String host, SSLContext sslContext, HttpHandler rootHandler) {
    this.type = type;
    this.port = port;
    this.host = host;
    this.rootHandler = rootHandler;
    this.keyManagers = null;
    this.trustManagers = null;
    this.sslContext = sslContext;
    this.overrideSocketOptions = OptionMap.EMPTY;
    this.useProxyProtocol = false;
}
 
Example 4
Source File: ConnectorUtils.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
protected static OptionMap getOptions(OperationContext context, ModelNode properties) throws OperationFailedException {
    if (properties.isDefined() && properties.asInt() > 0) {
        OptionMap.Builder builder = OptionMap.builder();
        addOptions(context, properties, builder);
        return builder.getMap();
    } else {
        return OptionMap.EMPTY;
    }
}
 
Example 5
Source File: SNICombinedWithALPNTestCase.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private XnioSsl createClientSSL(File hostNameKeystore) throws NoSuchAlgorithmException, KeyStoreException, IOException, CertificateException, UnrecoverableKeyException, KeyManagementException {
    SSLContext clientContext = SSLContext.getInstance("TLS");
    KeyStore store = KeyStore.getInstance("jks");
    try (FileInputStream in = new FileInputStream(hostNameKeystore)) {
        store.load(in, PASSWORD.toCharArray());
    }

    KeyManagerFactory km = KeyManagerFactory.getInstance(keyAlgorithm());
    km.init(store, PASSWORD.toCharArray());
    TrustManagerFactory tm = TrustManagerFactory.getInstance(keyAlgorithm());
    tm.init(store);
    clientContext.init(km.getKeyManagers(), tm.getTrustManagers(), new SecureRandom());
    return new UndertowXnioSsl(Xnio.getInstance(), OptionMap.EMPTY, clientContext);
}
 
Example 6
Source File: TokenAuthenticator.java    From hawkular-metrics with Apache License 2.0 5 votes vote down vote up
private ConnectionFactory(URI kubernetesMasterUri) {
    this.kubernetesMasterUri = kubernetesMasterUri;
    undertowClient = UndertowClient.getInstance();
    Xnio xnio = Xnio.getInstance(Undertow.class.getClassLoader());
    try {
        ssl = new UndertowXnioSsl(xnio, OptionMap.EMPTY);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    byteBufferPool = createByteBufferPool();
}
 
Example 7
Source File: ExtendedLoadBalancingProxyClient.java    From galeb with Apache License 2.0 5 votes vote down vote up
public synchronized ExtendedLoadBalancingProxyClient addHost(final URI host, String jvmRoute, XnioSsl ssl) {

        Host h = new Host(jvmRoute, null, host, ssl, OptionMap.EMPTY);
        Host[] existing = hosts;
        Host[] newHosts = new Host[existing.length + 1];
        System.arraycopy(existing, 0, newHosts, 0, existing.length);
        newHosts[existing.length] = h;
        sortHosts(newHosts);
        this.hosts = newHosts;
        if (jvmRoute != null) {
            this.routes.put(jvmRoute, h);
        }
        return this;
    }
 
Example 8
Source File: ConsulClientImpl.java    From light-4j with Apache License 2.0 5 votes vote down vote up
/**
 * Construct ConsulClient with all parameters from consul.yml config file. The other two constructors are
 * just for backward compatibility.
 */
public ConsulClientImpl() {
	String consulUrl = config.getConsulUrl().toLowerCase();
	optionMap =  isHttp2() ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true) : OptionMap.EMPTY;
	logger.debug("url = {}", consulUrl);
	if(config.getWait() != null && config.getWait().length() > 2) wait = config.getWait();
	logger.debug("wait = {}", wait);
	try {
		uri = new URI(consulUrl);
	} catch (URISyntaxException e) {
		logger.error("Invalid URI " + consulUrl, e);
		throw new RuntimeException("Invalid URI " + consulUrl, e);
	}
	maxReqPerConn = config.getMaxReqPerConn() > 0 ? config.getMaxReqPerConn() : 1000000;
}
 
Example 9
Source File: LoadBalancingProxyClient.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public synchronized LoadBalancingProxyClient addHost(final URI host, String jvmRoute, XnioSsl ssl) {

        Host h = new Host(jvmRoute, null, host, ssl, OptionMap.EMPTY);
        Host[] existing = hosts;
        Host[] newHosts = new Host[existing.length + 1];
        System.arraycopy(existing, 0, newHosts, 0, existing.length);
        newHosts[existing.length] = h;
        this.hosts = newHosts;
        if (jvmRoute != null) {
            this.routes.put(jvmRoute, h);
        }
        return this;
    }
 
Example 10
Source File: HttpOpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public HttpOpenListener(final ByteBufferPool pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 11
Source File: InVMConnection.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public OptionMap getUndertowOptions() {
    return OptionMap.EMPTY;
}
 
Example 12
Source File: InVMConnection.java    From thorntail with Apache License 2.0 4 votes vote down vote up
@Override
public OptionMap getUndertowOptions() {
    return OptionMap.EMPTY;
}
 
Example 13
Source File: AlpnOpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public AlpnOpenListener(ByteBufferPool bufferPool) {
    this(bufferPool, OptionMap.EMPTY, null, null);
}
 
Example 14
Source File: HttpOpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public HttpOpenListener(final Pool<ByteBuffer> pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 15
Source File: Http2OpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public Http2OpenListener(final ByteBufferPool pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 16
Source File: Http2OpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Deprecated
public Http2OpenListener(final Pool<ByteBuffer> pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 17
Source File: AjpOpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public AjpOpenListener(final ByteBufferPool pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 18
Source File: AjpOpenListener.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public AjpOpenListener(final Pool<ByteBuffer> pool) {
    this(pool, OptionMap.EMPTY);
}
 
Example 19
Source File: ServletInitialHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public OptionMap getUndertowOptions() {
    return OptionMap.EMPTY;
}