@Override public boolean preferred(Node node) { OutboundSocketBinding binding = this.binding.get(); try { return binding.getResolvedDestinationAddress().equals(node.getSocketAddress().getAddress()) && (binding.getDestinationPort() == node.getSocketAddress().getPort()); } catch (UnknownHostException e) { throw new IllegalArgumentException(e); } } }
@Override public void accept(P protocol) { if (!this.bindings.isEmpty()) { List<A> initialHosts = new ArrayList<>(this.bindings.size()); for (Supplier<OutboundSocketBinding> bindingValue : this.bindings) { OutboundSocketBinding binding = bindingValue.get(); try { initialHosts.add(this.hostTransformer.apply(new InetSocketAddress(binding.getResolvedDestinationAddress(), binding.getDestinationPort()))); } catch (UnknownHostException e) { throw JGroupsLogger.ROOT_LOGGER.failedToResolveSocketBinding(e, binding); } } // In the absence of some common interface, we need to use reflection PrivilegedAction<Protocol> action = () -> protocol.setValue("initial_hosts", initialHosts); WildFlySecurityManager.doUnchecked(action); } } }
/** * @deprecated use {@link #getResolvedDestinationAddress()} instead to get the resolved destination address * or {@link #getUnresolvedDestinationAddress()} to get the unresolved destination address. */ @Deprecated public synchronized InetAddress getDestinationAddress() throws UnknownHostException { return getResolvedDestinationAddress(); }
@Override public InetAddress getAddress() { try { return outboundSocketBinding.getResolvedDestinationAddress(); } catch (UnknownHostException e) { throw new UncheckedIOException(e); } }
/** * @deprecated Use {@link #getResolvedDestinationAddress()} instead to get the resolved destination address * or {@link #getUnresolvedDestinationAddress()} to get the unresolved destination address. */ @Deprecated public synchronized InetAddress getDestinationAddress() throws UnknownHostException { return getResolvedDestinationAddress(); }
@Override public InetAddress getAddress() { try { return outboundSocketBinding.getResolvedDestinationAddress(); } catch (UnknownHostException e) { throw new UncheckedIOException(e); } }
public static InetAddress outboundSocketBindingGetResolvedDestinationAddress(OutboundSocketBinding serverBinding) throws UnknownHostException { try { return serverBinding.getResolvedDestinationAddress(); } catch (NoSuchMethodError _nsme) { // When using jboss-as we need to use the now deprecated getDestinationAddress return serverBinding.getDestinationAddress(); } }
@Override public boolean preferred(Node node) { OutboundSocketBinding binding = this.binding.get(); try { return binding.getResolvedDestinationAddress().equals(node.getSocketAddress().getAddress()) && (binding.getDestinationPort() == node.getSocketAddress().getPort()); } catch (UnknownHostException e) { throw new IllegalArgumentException(e); } } }
/** * Creates a {@link Socket} represented by this {@link OutboundSocketBinding} and connects to the * destination * * @return * @throws IOException */ public Socket connect() throws IOException { final Socket socket = this.createSocket(); final InetAddress destinationAddress = this.getResolvedDestinationAddress(); final int destinationPort = this.getDestinationPort(); final SocketAddress destination = new InetSocketAddress(destinationAddress, destinationPort); socket.connect(destination); return socket; }
/** * Creates a {@link Socket} represented by this {@link OutboundSocketBinding} and connects to the * destination. * * @return the created and connected socket * @throws IOException */ public Socket connect() throws IOException { final Socket socket = this.createSocket(); final InetAddress destinationAddress = this.getResolvedDestinationAddress(); final int destinationPort = this.getDestinationPort(); final SocketAddress destination = new InetSocketAddress(destinationAddress, destinationPort); socket.connect(destination); return socket; }
@Override public void accept(P protocol) { if (!this.bindings.isEmpty()) { List<A> initialHosts = new ArrayList<>(this.bindings.size()); for (Supplier<OutboundSocketBinding> bindingValue : this.bindings) { OutboundSocketBinding binding = bindingValue.get(); try { initialHosts.add(this.hostTransformer.apply(new InetSocketAddress(binding.getResolvedDestinationAddress(), binding.getDestinationPort()))); } catch (UnknownHostException e) { throw JGroupsLogger.ROOT_LOGGER.failedToResolveSocketBinding(e, binding); } } // In the absence of some common interface, we need to use reflection PrivilegedAction<Protocol> action = () -> protocol.setValue("initial_hosts", initialHosts); WildFlySecurityManager.doUnchecked(action); } } }
@Override public void inject(OutboundSocketBinding value) { try { builder.host(value.getResolvedDestinationAddress().getHostAddress()).port(value.getDestinationPort()); // FIXME: add support for multiple hosts } catch (UnknownHostException e) { throw InfinispanMessages.MESSAGES.failedToInjectSocketBinding(e, value); } } };
@Override public void inject(OutboundSocketBinding value) { try { builder.addServer().host(value.getResolvedDestinationAddress().getHostAddress()).port(value.getDestinationPort()); } catch (UnknownHostException e) { throw InfinispanMessages.MESSAGES.failedToInjectSocketBinding(e, value); } } };