@Override public void accept(T protocol) { InetSocketAddress socketAddress = this.getSocketBinding().getSocketAddress(); protocol.setBindAddress(socketAddress.getAddress()); protocol.setBindPort(socketAddress.getPort()); protocol.setThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("jgroups", false, true), JChannelFactory.class.getClassLoader())); protocol.setThreadPool(this.threadPoolFactory.get().apply(protocol.getThreadFactory())); protocol.setInternalThreadPoolThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("jgroups-int", false, false), JChannelFactory.class.getClassLoader())); // Because we provide the transport with a thread pool, TP.init() won't auto-create the internal thread pool // So create one explicitly matching the logic in TP.init() but with our thread factory QueuelessThreadPoolFactory factory = new QueuelessThreadPoolFactory() .setMaxThreads(Math.max(4, Runtime.getRuntime().availableProcessors())) .setKeepAliveTime(30000) ; protocol.setInternalThreadPool(factory.apply(protocol.getInternalThreadPoolThreadFactory())); protocol.setValue("enable_diagnostics", this.diagnosticsSocketBinding != null); if (this.diagnosticsSocketBinding != null) { InetSocketAddress address = this.diagnosticsSocketBinding.get().getSocketAddress(); protocol.setValue("diagnostics_addr", address.getAddress()); protocol.setValue("diagnostics_port", address.getPort()); } }
@Override public void accept(T protocol) { InetSocketAddress socketAddress = this.getSocketBinding().getSocketAddress(); protocol.setBindAddress(socketAddress.getAddress()); protocol.setBindPort(socketAddress.getPort()); protocol.setThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("jgroups", false, true), JChannelFactory.class.getClassLoader())); protocol.setThreadPool(this.threadPoolFactory.get().apply(protocol.getThreadFactory())); protocol.setInternalThreadPoolThreadFactory(new ClassLoaderThreadFactory(new DefaultThreadFactory("jgroups-int", false, false), JChannelFactory.class.getClassLoader())); // Because we provide the transport with a thread pool, TP.init() won't auto-create the internal thread pool // So create one explicitly matching the logic in TP.init() but with our thread factory QueuelessThreadPoolFactory factory = new QueuelessThreadPoolFactory() .setMaxThreads(Math.max(4, Runtime.getRuntime().availableProcessors())) .setKeepAliveTime(30000) ; protocol.setInternalThreadPool(factory.apply(protocol.getInternalThreadPoolThreadFactory())); protocol.setValue("enable_diagnostics", this.diagnosticsSocketBinding != null); if (this.diagnosticsSocketBinding != null) { InetSocketAddress address = this.diagnosticsSocketBinding.get().getSocketAddress(); protocol.setValue("diagnostics_addr", address.getAddress()); protocol.setValue("diagnostics_port", address.getPort()); } }