Package com.hazelcast.config

Examples of com.hazelcast.config.MulticastConfig


    private MulticastService createMulticastService(AddressPicker addressPicker) {
        MulticastService mcService = null;
        try {
            JoinConfig join = config.getNetworkConfig().getJoin();
            if (join.getMulticastConfig().isEnabled()) {
                MulticastConfig multicastConfig = join.getMulticastConfig();
                MulticastSocket multicastSocket = new MulticastSocket(null);
                multicastSocket.setReuseAddress(true);
                // bind to receive interface
                multicastSocket.bind(new InetSocketAddress(multicastConfig.getMulticastPort()));
                multicastSocket.setTimeToLive(multicastConfig.getMulticastTimeToLive());
                try {
                    // set the send interface
                    final Address bindAddress = addressPicker.getBindAddress();
                    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4417033
                    // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6402758
                    if (!bindAddress.getInetAddress().isLoopbackAddress()) {
                        multicastSocket.setInterface(bindAddress.getInetAddress());
                    }
                } catch (Exception e) {
                    logger.warning(e);
                }
                multicastSocket.setReceiveBufferSize(64 * 1024);
                multicastSocket.setSendBufferSize(64 * 1024);
                String multicastGroup = System.getProperty("hazelcast.multicast.group");
                if (multicastGroup == null) {
                    multicastGroup = multicastConfig.getMulticastGroup();
                }
                multicastConfig.setMulticastGroup(multicastGroup);
                multicastSocket.joinGroup(InetAddress.getByName(multicastGroup));
                multicastSocket.setSoTimeout(1000);
                mcService = new MulticastService(this, multicastSocket);
                mcService.addMulticastListener(new NodeMulticastListener(this));
            }
View Full Code Here


        Config config = node.getConfig();
        this.multicastSocket = multicastSocket;

        sendOutput = node.getSerializationService().createObjectDataOutput(1024);
        datagramPacketReceive = new DatagramPacket(new byte[DATAGRAM_BUFFER_SIZE], DATAGRAM_BUFFER_SIZE);
        final MulticastConfig multicastConfig = config.getNetworkConfig().getJoin().getMulticastConfig();
        datagramPacketSend = new DatagramPacket(new byte[0], 0, InetAddress
                .getByName(multicastConfig.getMulticastGroup()), multicastConfig.getMulticastPort());
        running = true;
    }
View Full Code Here

      cfg.addMapConfig(mapcfg);
      cfg.setProperty("hazelcast.jmx", "true");
      cfg.setProperty("hazelcast.logging.type", "slf4j");
      if (Config.IN_PRODUCTION) {
        cfg.setNetworkConfig(new NetworkConfig().setJoin(new JoinConfig().
          setMulticastConfig(new MulticastConfig().setEnabled(false)).
            setTcpIpConfig(new TcpIpConfig().setEnabled(false)).
            setAwsConfig(new AwsConfig().setEnabled(true).
              setAccessKey(Config.AWS_ACCESSKEY).
              setSecretKey(Config.AWS_SECRETKEY).
              setRegion(Config.AWS_REGION).
View Full Code Here

      cfg.addMapConfig(mapcfg);
      cfg.setProperty("hazelcast.jmx", "true");
      cfg.setProperty("hazelcast.logging.type", "slf4j");
      if (Config.IN_PRODUCTION) {
        cfg.setNetworkConfig(new NetworkConfig().setJoin(new JoinConfig().
          setMulticastConfig(new MulticastConfig().setEnabled(false)).
            setTcpIpConfig(new TcpIpConfig().setEnabled(false)).
            setAwsConfig(new AwsConfig().setEnabled(true).
              setAccessKey(Config.AWS_ACCESSKEY).
              setSecretKey(Config.AWS_SECRETKEY).
              setRegion(Config.AWS_REGION).
View Full Code Here

TOP

Related Classes of com.hazelcast.config.MulticastConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.