Package org.apache.qpid.proton.engine

Examples of org.apache.qpid.proton.engine.Delivery


                while( currentBuffer !=null ) {
                    if( sender.getCredit() > 0 ) {
                        int sent = sender.send(currentBuffer.data, currentBuffer.offset, currentBuffer.length);
                        currentBuffer.moveHead(sent);
                        if( currentBuffer.length == 0 ) {
                            Delivery current = currentDelivery;
                            MessageDelivery md = (MessageDelivery) current.getContext();
                            currentBuffer = null;
                            currentDelivery = null;
                            if( qos == QoS.AT_MOST_ONCE ) {
                                current.settle();
                            } else {
                                sender.advance();
                            }
                            md.fireWatches();
                        }
View Full Code Here


            Sender sender = getLink(address.getHost(), port, new SenderFinder(address.getPath()));

            adjustReplyTo(m);

            byte[] tag = String.valueOf(_nextTag++).getBytes();
            Delivery delivery = sender.delivery(tag);
            int encoded;
            while (true)
            {
                try
                {
View Full Code Here

    {
        for (Connector c : _driver.connectors())
        {
            Connection connection = c.getConnection();
            _logger.log(Level.FINE, "Attempting to get message from " + connection);
            Delivery delivery = connection.getWorkHead();
            while (delivery != null)
            {
                if (delivery.isReadable())
                {
                    _logger.log(Level.FINE, "Readable delivery found: " + delivery);
                    int size = read((Receiver) delivery.getLink());
                    Message message = new MessageImpl();
                    message.decode(_buffer, 0, size);
                    _incoming.add(delivery);
                    _distributed--;
                    delivery.getLink().advance();
                    return message;
                }
                else
                {
                    _logger.log(Level.FINE, "Delivery not readable: " + delivery);
                    delivery = delivery.getWorkNext();
                }
            }
        }
        return null;
    }
View Full Code Here

            if (connection.getLocalState() == EndpointState.UNINITIALIZED)
            {
                connection.open();
            }

            Delivery delivery = connection.getWorkHead();
            while (delivery != null)
            {
                if (delivery.getLink() instanceof Sender && delivery.isUpdated())
                {
                    delivery.disposition(delivery.getRemoteState());
                }
                //TODO: delivery.clear(); What's the equivalent in java?
                delivery = delivery.getWorkNext();
            }
            _outgoing.slide();

            for (Session session : new Sessions(connection, UNINIT, ANY))
            {
View Full Code Here

        {
            if (unsettled != null)
            {
                while (unsettled.hasNext())
                {
                    Delivery d = unsettled.next();
                    if (d == null)
                    {
                        break;
                    }
                    if (d.getRemoteState() != null || d.remotelySettled())
                    {
                        d.settle();
                    }
                    else if (d.getLink().getSession().getConnection().getRemoteState() == EndpointState.CLOSED)
                    {
                        continue;
                    }
                    else
                    {
View Full Code Here

        {
            //do we have at least one message?
            for (Connector c : _driver.connectors())
            {
                Connection connection = c.getConnection();
                Delivery delivery = connection.getWorkHead();
                while (delivery != null)
                {
                    if (delivery.isReadable())
                    {
                        //TODO: check for partial delivery?
                        return true;
                    }
                    else
                    {
                        delivery = delivery.getWorkNext();
                    }
                }
            }
            return false;
        }
View Full Code Here

   public void handleDelivery(final Sender sender, byte[] tag, EncodedMessage encodedMessage, ServerMessage message, ProtonRemotingConnection connection, final boolean preSettle)
   {
      synchronized (connection.getDeliveryLock())
      {
         final Delivery delivery;
         delivery = sender.delivery(tag, 0, tag.length);
         delivery.setContext(message);
         sender.send(encodedMessage.getArray(), 0, encodedMessage.getLength());
         server.getStorageManager().afterCompleteOperations(new IOAsyncTask()
         {
            @Override
            public void done()
            {
               if (preSettle)
               {
                  delivery.settle();
                  ((LinkImpl) sender).addCredit(1);
               }
               else
               {
                  sender.advance();
View Full Code Here

   public void handleDelivery(final Sender sender, byte[] tag, EncodedMessage encodedMessage, ServerMessage message, ProtonRemotingConnection connection, final boolean preSettle)
   {
      synchronized (connection.getDeliveryLock())
      {
         final Delivery delivery;
         delivery = sender.delivery(tag, 0, tag.length);
         delivery.setContext(message);
         sender.send(encodedMessage.getArray(), 0, encodedMessage.getLength());
         server.getStorageManager().afterCompleteOperations(new IOAsyncTask()
         {
            @Override
            public void done()
            {
               if (preSettle)
               {
                  delivery.settle();
                  ((LinkImpl) sender).addCredit(1);
               }
               else
               {
                  sender.advance();
View Full Code Here

TOP

Related Classes of org.apache.qpid.proton.engine.Delivery

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.