@Override public InetSocketAddress getBindAddress() { return binding.getSocketAddress(); }
public synchronized void setEnabled(boolean enabled) { if(started && enabled != this.enabled) { if(enabled) { final InetSocketAddress socketAddress = binding.getValue().getSocketAddress(); final ChannelListener<AcceptingChannel<StreamConnection>> acceptListener = ChannelListeners.openListenerAdapter(openListener); try { startListening(worker.getValue(), socketAddress, acceptListener); } catch (IOException e) { throw new RuntimeException(e); } } else { stopListening(); } } this.enabled = enabled; }
recoveryEnvironmentBean.setRecoveryInetAddress(recoveryBinding.getSocketAddress().getAddress()); recoveryEnvironmentBean.setRecoveryPort(recoveryBinding.getSocketAddress().getPort()); final SocketBinding statusBinding = statusBindingInjector.getValue(); recoveryEnvironmentBean.setTransactionStatusManagerInetAddress(statusBinding.getSocketAddress().getAddress()); recoveryEnvironmentBean.setTransactionStatusManagerPort(statusBinding.getSocketAddress().getPort()); recoveryEnvironmentBean.setRecoveryListener(recoveryListener);
InetSocketAddress address = this.iiopSocketBindingInjector.getValue().getSocketAddress(); properties.setProperty(ORBConstants.SERVER_HOST_PROPERTY, address.getAddress().getHostAddress()); properties.setProperty(ORBConstants.SERVER_PORT_PROPERTY, String.valueOf(address.getPort())); InetSocketAddress address = this.iiopSSLSocketBindingInjector.getValue().getSocketAddress(); properties.setProperty(ORBConstants.SERVER_HOST_PROPERTY, address.getAddress().getHostAddress()); properties.setProperty(Constants.ORB_SSL_PORT, String.valueOf(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()); } }
@Override protected void preStart(final StartContext context) { //adds the HTTP upgrade service //TODO: have a bit more of a think about how we handle this context.getChildTarget().addService(HTTP_UPGRADE_REGISTRY.append(getName()), new ValueService<Object>(new ImmediateValue<Object>(httpUpgradeHandler))) .install(); ListenerRegistry.Listener listener = new ListenerRegistry.Listener(getProtocol(), getName(), serverName, getBinding().getValue().getSocketAddress()); listener.setContextInformation("socket-binding", getBinding().getValue()); httpListenerRegistry.getValue().addListener(listener); }
final InetSocketAddress socketAddress = binding.getValue().getSocketAddress(); if (e instanceof BindException) { final StringBuilder sb = new StringBuilder().append(e.getLocalizedMessage()); final InetSocketAddress socketAddress = binding.getValue().getSocketAddress(); if (socketAddress != null) sb.append(" ").append(socketAddress);
.setAdvertiseAddress(advertiseBinding.getSocketAddress().getAddress().getHostAddress()) .setAdvertiseGroup(multicastAddress.getHostAddress()) .setAdvertisePort(advertiseBinding.getMulticastPort()) builder.setManagementHost(managementSocketBinding.getValue().getSocketAddress().getHostString()); builder.setManagementPort(managementSocketBinding.getValue().getSocketAddress().getPort());
private int getDestinationPort() { final SocketBinding localDestinationSocketBinding = this.localDestinationSocketBindingInjectedValue.getValue(); // instead of directly using SocketBinding.getPort(), we go via the SocketBinding.getSocketAddress() // since the getPort() method doesn't take into account whether the port is a fixed port or whether an offset // needs to be added. Alternatively, we could introduce a getAbsolutePort() in the SocketBinding class. final InetSocketAddress socketAddress = localDestinationSocketBinding.getSocketAddress(); return socketAddress.getPort(); }
private int getDestinationPort() { final SocketBinding localDestinationSocketBinding = this.localDestinationSocketBindingInjectedValue.getValue(); // instead of directly using SocketBinding.getPort(), we go via the SocketBinding.getSocketAddress() // since the getPort() method doesn't take into account whether the port is a fixed port or whether a offset // needs to be added. Alternatively, we could introduce a getAbsolutePort() in the SocketBinding class. final InetSocketAddress socketAddress = localDestinationSocketBinding.getSocketAddress(); return socketAddress.getPort(); }
/** * Create a multicast socket. * * @return the multicast socket * @throws IOException */ // TODO JBAS-8470 automatically joingGroup public MulticastSocket createMulticastSocket() throws IOException { return socketBindings.createMulticastSocket(name, getSocketAddress()); }
/** * Create a multicast socket. * * @return the multicast socket * @throws IOException */ // TODO JBAS-8470 automatically joingGroup public MulticastSocket createMulticastSocket() throws IOException { return socketBindings.createMulticastSocket(name, getSocketAddress()); }
@Override public void start(StartContext context) throws StartException { for (ServiceName serviceName : socketBindingNames) { SocketBinding binding = (SocketBinding) serviceContainer.getRequiredService(serviceName).getValue(); Dictionary<String, String> props = new Hashtable<String, String>(); props.put("socketBinding", serviceName.getSimpleName()); InetSocketAddress value = binding.getSocketAddress(); syscontext.registerService(InetSocketAddress.class.getName(), value, props); } } });
/** * Create and bind a server socket. * * @param backlog the backlog * @return the server socket * @throws IOException */ public ServerSocket createServerSocket(int backlog) throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress(), backlog); return socket; }
/** * Create and bind a server socket. * * @param backlog the backlog * @return the server socket * @throws IOException */ public ServerSocket createServerSocket(int backlog) throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress(), backlog); return socket; }
/** * Create and bind a server socket * * @return the server socket * @throws IOException */ public ServerSocket createServerSocket() throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress()); return socket; }
/** * Create and bind a server socket. * * @param backlog the backlog * @return the server socket * @throws IOException */ public ServerSocket createServerSocket(int backlog) throws IOException { final ServerSocket socket = getServerSocketFactory().createServerSocket(name); socket.bind(getSocketAddress(), backlog); return socket; }
@Override public void start(StartContext context) throws StartException { for (ServiceName serviceName : socketBindingNames) { SocketBinding binding = (SocketBinding) serviceContainer.getRequiredService(serviceName).getValue(); Dictionary<String, String> props = new Hashtable<String, String>(); props.put("socketBinding", serviceName.getSimpleName()); InetSocketAddress value = binding.getSocketAddress(); syscontext.registerService(InetSocketAddress.class, value, props); } } });
@Override protected void preStart(final StartContext context) { //adds the HTTP upgrade service //TODO: have a bit more of a think about how we handle this context.getChildTarget().addService(HTTP_UPGRADE_REGISTRY.append(getName()), new ValueService<Object>(new ImmediateValue<Object>(httpUpgradeHandler))) .install(); ListenerRegistry.Listener listener = new ListenerRegistry.Listener(getProtocol(), getName(), serverName, getBinding().getValue().getSocketAddress()); listener.setContextInformation("socket-binding", getBinding().getValue()); httpListenerRegistry.getValue().addListener(listener); }
@Override protected void preStart(final StartContext context) { //adds the HTTP upgrade service //TODO: have a bit more of a think about how we handle this context.getChildTarget().addService(HTTP_UPGRADE_REGISTRY.append(getName()), new ValueService<Object>(new ImmediateValue<Object>(httpUpgradeHandler))) .install(); ListenerRegistry.Listener listener = new ListenerRegistry.Listener(getProtocol(), getName(), serverName, getBinding().getValue().getSocketAddress()); listener.setContextInformation("socket-binding", getBinding().getValue()); httpListenerRegistry.getValue().addListener(listener); }