Package org.apache.cassandra.net

Examples of org.apache.cassandra.net.MessageProducer


                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here


                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

        }
        catch (InterruptedException e)
        {
            throw new RuntimeException(e);
        }
        MessageProducer prod = new MessageProducer()
        {
            public Message getMessage(Integer version) throws IOException
            {
                return makeGossipShutdownMessage(version);
            }
        };
        for (InetAddress ep : liveEndpoints)
        {
            try
            {
                MessagingService.instance().sendOneWay(prod.getMessage(getVersion(ep)), ep);
            }
            catch (IOException ex)
            {
                // keep going
            }
View Full Code Here

                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

        }
        catch (InterruptedException e)
        {
            throw new RuntimeException(e);
        }
        MessageProducer prod = new MessageProducer()
        {
            public Message getMessage(Integer version) throws IOException
            {
                return makeGossipShutdownMessage(version);
            }
        };
        for (InetAddress ep : liveEndpoints)
        {
            try
            {
                MessagingService.instance().sendOneWay(prod.getMessage(getVersion(ep)), ep);
            }
            catch (IOException ex)
            {
                // keep going
            }
View Full Code Here

                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

                final List<GossipDigest> gDigests = new ArrayList<GossipDigest>();
                Gossiper.instance.makeRandomGossipDigest(gDigests);

                if ( gDigests.size() > 0 )
                {
                    MessageProducer prod = new MessageProducer()
                    {
                        public Message getMessage(Integer version) throws IOException
                        {
                            return makeGossipDigestSynMessage(gDigests, version);
                        }
View Full Code Here

    private static void sendToHintedEndpoints(final RowMutation rm, Multimap<InetAddress, InetAddress> hintedEndpoints, IWriteResponseHandler responseHandler, String localDataCenter, boolean insertLocalMessages, ConsistencyLevel consistency_level)
    throws IOException
    {
        // Multimap that holds onto all the messages and addresses meant for a specific datacenter
        Map<String, Multimap<Message, InetAddress>> dcMessages = new HashMap<String, Multimap<Message, InetAddress>>(hintedEndpoints.size());
        MessageProducer producer = new CachingMessageProducer(rm);

        for (Map.Entry<InetAddress, Collection<InetAddress>> entry : hintedEndpoints.asMap().entrySet())
        {
            InetAddress destination = entry.getKey();
            Collection<InetAddress> targets = entry.getValue();

            String dc = DatabaseDescriptor.getEndpointSnitch().getDatacenter(destination);

            if (targets.size() == 1 && targets.iterator().next().equals(destination))
            {
                // unhinted writes
                if (destination.equals(FBUtilities.getLocalAddress()))
                {
                    if (insertLocalMessages)
                        insertLocal(rm, responseHandler);
                }
                else
                {
                    // belongs on a different server
                    if (logger.isDebugEnabled())
                        logger.debug("insert writing key " + ByteBufferUtil.bytesToHex(rm.key()) + " to " + destination);

                    Multimap<Message, InetAddress> messages = dcMessages.get(dc);
                    if (messages == null)
                    {
                       messages = HashMultimap.create();
                       dcMessages.put(dc, messages);
                    }

                    messages.put(producer.getMessage(Gossiper.instance.getVersion(destination)), destination);
                }
            }
            else
            {
                // hinted messages are unique, so there is no point to adding a hop by forwarding via another node.
View Full Code Here

TOP

Related Classes of org.apache.cassandra.net.MessageProducer

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.