Example usage for io.netty.util.internal PlatformDependent newFixedMpscQueue

List of usage examples for io.netty.util.internal PlatformDependent newFixedMpscQueue

Introduction

In this page you can find the example usage for io.netty.util.internal PlatformDependent newFixedMpscQueue.

Prototype

public static <T> Queue<T> newFixedMpscQueue(int capacity) 

Source Link

Document

Create a new Queue which is safe to use for multiple producers (different threads) and a single consumer (one thread!) with the given fixes capacity .

Usage

From source file:com.floragunn.searchguard.ssl.SearchGuardSSLPlugin.java

License:Apache License

public SearchGuardSSLPlugin(final Settings settings) {

    final SecurityManager sm = System.getSecurityManager();

    if (sm != null) {
        sm.checkPermission(new SpecialPermission());
    }//from ww  w  .j a  v a  2s.  c o m

    // initialize native netty open ssl libs
    AccessController.doPrivileged(new PrivilegedAction<Object>() {
        @Override
        public Object run() {
            PlatformDependent.newFixedMpscQueue(1);
            OpenSsl.isAvailable();
            return null;
        }
    });

    try {
        getClass().getClassLoader().loadClass("com.floragunn.searchguard.SearchGuardPlugin");
        searchGuardPluginAvailable = settings.getAsArray("searchguard.authcz.admin_dn",
                new String[0]).length > 0;
    } catch (final ClassNotFoundException cnfe) {
        searchGuardPluginAvailable = false;
    }

    if (searchGuardPluginAvailable) {
        log.info("Search Guard 2 plugin also available");
    } else {
        log.info("Search Guard 2 plugin not available");
    }

    this.settings = settings;
    client = !"node".equals(this.settings.get(SearchGuardSSLPlugin.CLIENT_TYPE));
    httpSSLEnabled = settings.getAsBoolean(SSLConfigConstants.SEARCHGUARD_SSL_HTTP_ENABLED,
            SSLConfigConstants.SEARCHGUARD_SSL_HTTP_ENABLED_DEFAULT);
    transportSSLEnabled = settings.getAsBoolean(SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_ENABLED,
            SSLConfigConstants.SEARCHGUARD_SSL_TRANSPORT_ENABLED_DEFAULT);

    if (!httpSSLEnabled && !transportSSLEnabled) {
        log.error("SSL not activated for http and/or transport.");
        System.out.println("SSL not activated for http and/or transport.");
    }

}