@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()); } }
public void setBindAddress(String bind_address) throws UnknownHostException { tp.setBindAddress(bind_address); }
InetAddress bind_addr; // detect address by using Azure's SDK JChannel ch=new JChannel("config.xml"); TP transport=ch.getProtocolStack().getTransport(); transport.setBindAddress(bind_addr); ch.connect("mycluster");
@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()); } }