/** * Build a {@link io.netty.handler.ssl.SslHandler} when the side band server * is configured to use ssl for websocket. * * @param esc * @return the ssl handler, never null. */ public static SslHandler buildSslHandler(ErraiServiceConfigurator esc) { keyPassword = StringUtils.isEmpty(keyPassword) ? ErraiConfigAttribs.WEB_SOCKET_KEY_PASSWORD.get(esc) : keyPassword; if (keyStore == null) { final String keyStorePath = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE.get(esc); final String keystoreType = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE_TYPE.get(esc); if (StringUtils.isEmpty(keyStorePath)) { throw new IllegalStateException( "when ssl is activated for the sideband server, key store information is necessary"); } String keyStorePassword = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE_PASSWORD.get(esc); if (StringUtils.isEmpty(keyStorePassword)) { throw new IllegalStateException( "keystore configured for sideband websocket server, but missing keystore password"); } if (StringUtils.isEmpty(keyPassword)) { keyPassword = keyStorePassword; } keyStore = KeystoreFactory.getKeyStore(keyStorePath, keyStorePassword, keystoreType); } return new SslHandler(getSslEngine(keyStore, keyPassword)); }
webSocketPath = ErraiConfigAttribs.WEBSOCKET_SERVLET_CONTEXT_PATH.get(config); webSocketPort = -1; webSocketPath = ErraiConfigAttribs.WEB_SOCKET_URL.get(config); webSocketPort = ErraiConfigAttribs.WEB_SOCKET_PORT.getInt(config); Integer segmentSize = ErraiConfigAttribs.BUS_BUFFER_SEGMENT_SIZE.getInt(config); Integer segmentCount = ErraiConfigAttribs.BUS_BUFFER_SEGMENT_COUNT.getInt(config); final String allocMode = ErraiConfigAttribs.BUS_BUFFER_ALLOCATION_MODE.get(config); + ErraiConfigAttribs.BUS_BUFFER_ALLOCATION_MODE.get(config)); final String clusteringProviderCls = ErraiConfigAttribs.CLUSTERING_PROVIDER.get(config);
webSocketPath = ErraiConfigAttribs.WEBSOCKET_SERVLET_CONTEXT_PATH.get(config); webSocketPort = -1; webSocketPath = ErraiConfigAttribs.WEB_SOCKET_URL.get(config); webSocketPort = ErraiConfigAttribs.WEB_SOCKET_PORT.getInt(config); Integer segmentSize = ErraiConfigAttribs.BUS_BUFFER_SEGMENT_SIZE.getInt(config); Integer segmentCount = ErraiConfigAttribs.BUS_BUFFER_SEGMENT_COUNT.getInt(config); final String allocMode = ErraiConfigAttribs.BUS_BUFFER_ALLOCATION_MODE.get(config); + ErraiConfigAttribs.BUS_BUFFER_ALLOCATION_MODE.get(config)); final String clusteringProviderCls = ErraiConfigAttribs.CLUSTERING_PROVIDER.get(config);
/** * Constructs a new PooledExecutorService with the specified queue size. * * @param queueSize The size of the underlying worker queue. */ public PooledExecutorService(int queueSize) { this(queueSize, SaturationPolicy.valueOf( ErraiConfigAttribs.SATURATION_POLICY.get(new ErraiServiceConfiguratorImpl()))); }
@Override protected void configure() { final Class<? extends RequestDispatcher> dispatcherImplementation; final String dispatcherImpl = ErraiConfigAttribs.ERRAI_DISPATCHER_IMPLEMENTATION.get(config); try { dispatcherImplementation = Class.forName(dispatcherImpl).asSubclass(RequestDispatcher.class); } catch (Exception e) { throw new ErraiBootstrapFailure("could not load request dispatcher implementation class", e); } log.info("using dispatcher implementation: " + dispatcherImplementation.getName()); bind(RequestDispatcher.class).to(dispatcherImplementation); bind(ErraiService.class).toInstance(context.getService()); bind(MessageBus.class).toInstance(context.getBus()); bind(ErraiServiceConfigurator.class).toInstance(config); } }).getInstance(RequestDispatcher.class);
@Override protected void configure() { final Class<? extends SessionProvider> sessionProviderImplementation; final String sessionProviderImpl = ErraiConfigAttribs.ERRAI_SESSION_PROVIDER_IMPLEMENTATION.get(config); try { sessionProviderImplementation = Class.forName(sessionProviderImpl) .asSubclass(SessionProvider.class); } catch (Exception e) { throw new ErraiBootstrapFailure("could not load session provider implementation class", e); } log.info("using session provider implementation: " + sessionProviderImplementation.getName()); bind(SessionProvider.class).to(sessionProviderImplementation); bind(ErraiService.class).toInstance(context.getService()); bind(MessageBus.class).toInstance(context.getBus()); bind(ErraiServiceConfigurator.class).toInstance(config); } }).getInstance(SessionProvider.class);
@Inject private JGroupsClusteringProvider(final ServerMessageBus messageBus, final ErraiServiceConfigurator config, final ErraiService erraiService) { this.serverMessageBus = messageBus; try { jchannel = new JChannel(JGroupsConfigAttribs.JGROUPS_PROTOCOL_STACK.get(config)); jchannel.connect(ErraiConfigAttribs.CLUSTER_NAME.get(config)); // I don't think waiting for the state is necessary. // jchannel.getState(null, 2000); } catch (Exception e) { throw new RuntimeException(e); } serverMessageBus.subscribe(CLUSTER_SERVICE, this); jchannel.setReceiver(this); erraiService.addShutdownHook(new Runnable() { @Override public void run() { jchannel.close(); log.info("shut down jgroups clustering service"); } }); sessionToNodeCache = CacheBuilder.newBuilder() .maximumSize(100) .build(); log.info("starting errai clustering service."); }
/** * Build a {@link io.netty.handler.ssl.SslHandler} when the side band server * is configured to use ssl for websocket. * * @param esc * @return the ssl handler, never null. */ public static SslHandler buildSslHandler(ErraiServiceConfigurator esc) { keyPassword = StringUtils.isEmpty(keyPassword) ? ErraiConfigAttribs.WEB_SOCKET_KEY_PASSWORD.get(esc) : keyPassword; if (keyStore == null) { final String keyStorePath = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE.get(esc); final String keystoreType = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE_TYPE.get(esc); if (StringUtils.isEmpty(keyStorePath)) { throw new IllegalStateException( "when ssl is activated for the sideband server, key store information is necessary"); } String keyStorePassword = ErraiConfigAttribs.WEB_SOCKET_KEYSTORE_PASSWORD.get(esc); if (StringUtils.isEmpty(keyStorePassword)) { throw new IllegalStateException( "keystore configured for sideband websocket server, but missing keystore password"); } if (StringUtils.isEmpty(keyPassword)) { keyPassword = keyStorePassword; } keyStore = KeystoreFactory.getKeyStore(keyStorePath, keyStorePassword, keystoreType); } return new SslHandler(getSslEngine(keyStore, keyPassword)); }
/** * Constructs a new PooledExecutorService with the specified queue size. * * @param queueSize The size of the underlying worker queue. */ public PooledExecutorService(int queueSize) { this(queueSize, SaturationPolicy.valueOf( ErraiConfigAttribs.SATURATION_POLICY.get(new ErraiServiceConfiguratorImpl()))); }
@Override protected void configure() { final Class<? extends RequestDispatcher> dispatcherImplementation; final String dispatcherImpl = ErraiConfigAttribs.ERRAI_DISPATCHER_IMPLEMENTATION.get(config); try { dispatcherImplementation = Class.forName(dispatcherImpl).asSubclass(RequestDispatcher.class); } catch (Exception e) { throw new ErraiBootstrapFailure("could not load request dispatcher implementation class", e); } log.info("using dispatcher implementation: " + dispatcherImplementation.getName()); bind(RequestDispatcher.class).to(dispatcherImplementation); bind(ErraiService.class).toInstance(context.getService()); bind(MessageBus.class).toInstance(context.getBus()); bind(ErraiServiceConfigurator.class).toInstance(config); } }).getInstance(RequestDispatcher.class);
@Override protected void configure() { final Class<? extends SessionProvider> sessionProviderImplementation; final String sessionProviderImpl = ErraiConfigAttribs.ERRAI_SESSION_PROVIDER_IMPLEMENTATION.get(config); try { sessionProviderImplementation = Class.forName(sessionProviderImpl) .asSubclass(SessionProvider.class); } catch (Exception e) { throw new ErraiBootstrapFailure("could not load session provider implementation class", e); } log.info("using session provider implementation: " + sessionProviderImplementation.getName()); bind(SessionProvider.class).to(sessionProviderImplementation); bind(ErraiService.class).toInstance(context.getService()); bind(MessageBus.class).toInstance(context.getBus()); bind(ErraiServiceConfigurator.class).toInstance(config); } }).getInstance(SessionProvider.class);
@Inject private JGroupsClusteringProvider(final ServerMessageBus messageBus, final ErraiServiceConfigurator config, final ErraiService erraiService) { this.serverMessageBus = messageBus; try { jchannel = new JChannel(JGroupsConfigAttribs.JGROUPS_PROTOCOL_STACK.get(config)); jchannel.connect(ErraiConfigAttribs.CLUSTER_NAME.get(config)); // I don't think waiting for the state is necessary. // jchannel.getState(null, 2000); } catch (Exception e) { throw new RuntimeException(e); } serverMessageBus.subscribe(CLUSTER_SERVICE, this); jchannel.setReceiver(this); erraiService.addShutdownHook(new Runnable() { @Override public void run() { jchannel.close(); log.info("shut down jgroups clustering service"); } }); sessionToNodeCache = CacheBuilder.newBuilder() .maximumSize(100) .build(); log.info("starting errai clustering service."); }