@Test public void shouldAutowire() throws UnknownHostException { Config localhost = config.config(new HazelcastQuorumListener(1), "localhost"); assertNotNull(localhost); localhost = config.config(new HazelcastQuorumListener(2), "localhost, 127.0.0.1"); assertNotNull(localhost); }
@Bean Config config( final MembershipListener listener, @Value("${clustering.hazelcast.members:127.0.0.1}") final String members) throws UnknownHostException { final Config config = new Config(); final NetworkConfig network = config.getNetworkConfig(); final JoinConfig join = network.getJoin(); final MulticastConfig multicast = join.getMulticastConfig(); multicast.setEnabled(false); final TcpIpConfig tcpIp = join.getTcpIpConfig(); tcpIp.setEnabled(true); for(final String member : COMA.splitToList(members)) { final InetAddress[] addresses = MoreObjects.firstNonNull( InetAddress.getAllByName(member), new InetAddress[0]); for (final InetAddress addr : addresses) { final String hostAddress = addr.getHostAddress(); tcpIp.addMember(hostAddress); log.info("[Hazelcast] New Member: " + hostAddress); } } return config.addListenerConfig(new ListenerConfig(listener)); }
HazelcastConfig { @Bean Config config( final MembershipListener listener, @Value("${clustering.hazelcast.members:127.0.0.1}") final String members) throws UnknownHostException { final Config config = new Config(); final NetworkConfig network = config.getNetworkConfig(); final JoinConfig join = network.getJoin(); final MulticastConfig multicast = join.getMulticastConfig(); multicast.setEnabled(false); final TcpIpConfig tcpIp = join.getTcpIpConfig(); tcpIp.setEnabled(true); for(final String member : COMA.splitToList(members)) { final InetAddress[] addresses = MoreObjects.firstNonNull( InetAddress.getAllByName(member), new InetAddress[0]); for (final InetAddress addr : addresses) { final String hostAddress = addr.getHostAddress(); tcpIp.addMember(hostAddress); log.info("[Hazelcast] New Member: " + hostAddress); } } return config.addListenerConfig(new ListenerConfig(listener)); } }
HazelcastConfig { @Bean Config config( final MembershipListener listener, @Value("${clustering.hazelcast.members:127.0.0.1}") final String members) throws UnknownHostException { final Config config = new Config(); final NetworkConfig network = config.getNetworkConfig(); final JoinConfig join = network.getJoin(); final MulticastConfig multicast = join.getMulticastConfig(); multicast.setEnabled(false); final TcpIpConfig tcpIp = join.getTcpIpConfig(); tcpIp.setEnabled(true); for(final String member : COMA.splitToList(members)) { final InetAddress[] addresses = MoreObjects.firstNonNull( InetAddress.getAllByName(member), new InetAddress[0]); for (final InetAddress addr : addresses) { final String hostAddress = addr.getHostAddress(); tcpIp.addMember(hostAddress); log.info("[Hazelcast] New Member: " + hostAddress); } } return config.addListenerConfig(new ListenerConfig(listener)); }  }
HazelcastConfig { @Bean Config config( final MembershipListener listener, @Value("${clustering.hazelcast.members:127.0.0.1}") final String members) throws UnknownHostException { final Config config = new Config(); final NetworkConfig network = config.getNetworkConfig(); final JoinConfig join = network.getJoin(); final MulticastConfig multicast = join.getMulticastConfig(); multicast.setEnabled(false); final TcpIpConfig tcpIp = join.getTcpIpConfig(); tcpIp.setEnabled(true); for(final String member : COMA.splitToList(members)) { final InetAddress[] addresses = MoreObjects.firstNonNull( InetAddress.getAllByName(member), new InetAddress[0]); for (final InetAddress addr : addresses) { final String hostAddress = addr.getHostAddress(); tcpIp.addMember(hostAddress); log.info("[Hazelcast] New Member: " + hostAddress); } } return config.addListenerConfig(new ListenerConfig(listener)); }   }
HazelcastConfig { @Bean Config config( final MembershipListener listener, @Value("${clustering.hazelcast.members:127.0.0.1}") final String members) throws UnknownHostException { final Config config = new Config(); final NetworkConfig network = config.getNetworkConfig(); final JoinConfig join = network.getJoin(); final MulticastConfig multicast = join.getMulticastConfig(); multicast.setEnabled(false); final TcpIpConfig tcpIp = join.getTcpIpConfig(); tcpIp.setEnabled(true); for(final String member : COMA.splitToList(members)) { final InetAddress[] addresses = MoreObjects.firstNonNull( InetAddress.getAllByName(member), new InetAddress[0]); for (final InetAddress addr : addresses) { final String hostAddress = addr.getHostAddress(); tcpIp.addMember(hostAddress); log.info("[Hazelcast] New Member: " + hostAddress); } } return config.addListenerConfig(new ListenerConfig(listener)); }    }