Package org.apache.qpid.proton.engine

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


   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

                while (entries.hasNext() && total <= _sendThreshold)
                {
                    StoreEntry e = (StoreEntry) entries.next();
                    if (e != null )
                    {
                        Delivery d = e.getDelivery();
                        if (d != null)
                        {
                            if (d.getRemoteState() == null && !d.remotelySettled())
                            {
                                total++;
                            }
                        }
                    }
View Full Code Here

            //do we have at least one pending message?
            if (_incomingStore.size() > 0) return true;
            for (Connector<?> c : _driver.connectors())
            {
                Connection connection = c.getConnection();
                Delivery delivery = connection.getWorkHead();
                while (delivery != null)
                {
                    if (delivery.isReadable() && !delivery.isPartial())
                    {
                        return true;
                    }
                    else
                    {
                        delivery = delivery.getWorkNext();
                    }
                }
            }
            // if no connections, or not listening, exit as there won't ever be a message
            if (!_driver.listeners().iterator().hasNext() && !_driver.connectors().iterator().hasNext())
View Full Code Here

    static Delivery getDelivery(SWIGTYPE_p_pn_delivery_t delivery_t)
    {
        if(delivery_t != null)
        {
            Delivery deliveryObj = (Delivery) Proton.pn_delivery_get_context(delivery_t);
            if(deliveryObj == null)
            {
                deliveryObj = new JNIDelivery(delivery_t);
            }
            return deliveryObj;
View Full Code Here

        }

        Iterator<Delivery> dIter = link.unsettled();
        while (dIter != null && dIter.hasNext())
        {
            Delivery delivery = (Delivery) dIter.next();
            StoreEntry entry = (StoreEntry) delivery.getContext();
            if (entry != null)
            {
                entry.setDelivery(null);
                if (delivery.isBuffered())
                    entry.setStatus(Status.ABORTED);
            }
        }
        linkRemoved(link);
    }
View Full Code Here

            sender.drained();
            return 0;
        }

        byte[] tag = String.valueOf(_nextTag++).getBytes();
        Delivery delivery = sender.delivery(tag);
        entry.setDelivery( delivery );
        _logger.log(Level.FINE, "Sending on delivery: " + delivery);
        int n = sender.send( entry.getEncodedMsg(), 0, entry.getEncodedLength());
        if (n < 0) {
            _outgoingStore.freeEntry( entry );
View Full Code Here

        return null;
    }

    private int pumpIn(String address, Receiver receiver)
    {
        Delivery delivery = receiver.current();
        if (delivery.isReadable() && !delivery.isPartial())
        {
            StoreEntry entry = _incomingStore.put( address );
            entry.setDelivery( delivery );

            _logger.log(Level.FINE, "Readable delivery found: " + delivery);

            int size = delivery.pending();
            byte[] buffer = new byte[size];
            int read = receiver.recv( buffer, 0, buffer.length );
            if (read != size) {
                throw new IllegalStateException();
            }
View Full Code Here

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

        Delivery delivery = connection.getWorkHead();
        while (delivery != null)
        {
            Link link = delivery.getLink();
            if (delivery.isUpdated())
            {
                if (link instanceof Sender)
                {
                    delivery.disposition(delivery.getRemoteState());
                }
                StoreEntry e = (StoreEntry) delivery.getContext();
                if (e != null) e.updated();
            }

            if (delivery.isReadable())
            {
                pumpIn( link.getSource().getAddress(), (Receiver)link );
            }

            Delivery next = delivery.getWorkNext();
            delivery.clear();
            delivery = next;
        }

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

    static Delivery getDelivery(SWIGTYPE_p_pn_delivery_t delivery_t)
    {
        if(delivery_t != null)
        {
            Delivery deliveryObj = (Delivery) Proton.pn_delivery_get_context(delivery_t);
            if(deliveryObj == null)
            {
                deliveryObj = new JNIDelivery(delivery_t);
            }
            return deliveryObj;
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.