Package org.apache.qpid.amqp_1_0.transport

Examples of org.apache.qpid.amqp_1_0.transport.Predicate


        synchronized(_endpoint.getLock())
        {
            try
            {
                _endpoint.waitUntil(new Predicate()
                                    {
                                        @Override
                                        public boolean isSatisfied()
                                        {
                                            return _endpoint.isAttached() || _endpoint.isDetached();
View Full Code Here


        synchronized(lock)
        {

            try
            {
                _endpoint.waitUntil(new Predicate()
                                    {
                                        @Override
                                        public boolean isSatisfied()
                                        {
                                            return _endpoint.hasCreditToSend() || _endpoint.isDetached();
                                        }
                                    }, getCreditTimeout());
            }
            catch (InterruptedException e)
            {
                throw new TimeoutException("Interrupted while waiting for credit");
            }

            if(_endpoint.isDetached())
            {
                throw new LinkDetachedException(_error);
            }
            if(action != null)
            {
                _outcomeActions.put(message.getDeliveryTag(), action);
            }
            _endpoint.transfer(xfr);
        }

        if(_windowSize != 0)
        {
            try
            {
                _endpoint.waitUntil(new Predicate()
                                    {
                                        @Override
                                        public boolean isSatisfied()
                                        {
                                            return _endpoint.getUnsettledCount() < _windowSize;
View Full Code Here

        {
            long timeout = getUnsettledTimeout();

            try
            {
                _endpoint.waitUntil(new Predicate()
                {
                    @Override
                    public boolean isSatisfied()
                    {
                        return _endpoint.getUnsettledCount() == 0;
                    }
                }, timeout);
            }
            catch (InterruptedException e)
            {
                unsettledDeliveries = true;
            }
            catch (TimeoutException e)
            {
                unsettledDeliveries = true;
            }

        }
        _session.removeSender(this);
        _endpoint.setSource(null);
        _endpoint.close();
        _closed = true;

        try
        {
            _endpoint.waitUntil(new Predicate()
            {
                @Override
                public boolean isSatisfied()
                {
                    return _endpoint.isDetached();
View Full Code Here

        return _conn;
    }

    public void awaitOpen() throws TimeoutException, InterruptedException
    {
        getEndpoint().waitUntil(new Predicate()
        {
            @Override
            public boolean isSatisfied()
            {
                return getEndpoint().isOpen() || getEndpoint().isClosed();
View Full Code Here

    {
        _conn.close();

        try
        {
            _conn.waitUntil(new Predicate()
            {
                @Override
                public boolean isSatisfied()
                {
                    return _conn.closedForInput();
View Full Code Here

        _endpoint.setLocalUnsettled(unsettled);
        _endpoint.attach();

        try
        {
            _endpoint.waitUntil(new Predicate()
            {

                @Override
                public boolean isSatisfied()
                {
                    return _endpoint.isAttached() || _endpoint.isDetached();
                }
            });
        }
        catch (TimeoutException e)
        {
            throw new ConnectionErrorException(AmqpError.INTERNAL_ERROR,"Timeout waiting for attach");
        }
        catch (InterruptedException e)
        {
            throw new ConnectionErrorException(AmqpError.INTERNAL_ERROR,"Interrupted while waiting for attach");
        }

        if(_endpoint.getSource() == null)
        {
            try
            {
                _endpoint.waitUntil(new Predicate()
                {
                    @Override
                    public boolean isSatisfied()
                    {
                        return _endpoint.isDetached();
View Full Code Here

       /*         if(!localTxn)
                {
                    capabilities.add(TxnCapabilities.LOCAL_TXN);
                }*/

                final ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
                final TxnCoordinatorLink_1_0 coordinatorLink =
                        new TxnCoordinatorLink_1_0(_vhost, this, receivingLinkEndpoint, _openTransactions);
                receivingLinkEndpoint.setLinkEventListener(coordinatorLink);
                link = coordinatorLink;


            }
            else
            {

                ReceivingLink_1_0 previousLink =
                        (ReceivingLink_1_0) linkRegistry.getDurableReceivingLink(endpoint.getName());

                if(previousLink == null)
                {

                    Target target = (Target) endpoint.getTarget();

                    if(target != null)
                    {
                        if(Boolean.TRUE.equals(target.getDynamic()))
                        {

                            AMQQueue tempQueue = createTemporaryQueue(target.getDynamicNodeProperties());
                            target.setAddress(tempQueue.getName());
                        }

                        String addr = target.getAddress();
                        Exchange exchg = _vhost.getExchange(addr);
                        if(exchg != null)
                        {
                            destination = new ExchangeDestination(exchg, target.getDurable(),
                                                                  target.getExpiryPolicy());
                        }
                        else
                        {
                            AMQQueue queue = _vhost.getQueue(addr);
                            if(queue != null)
                            {

                                destination = new QueueDestination(queue);
                            }
                            else
                            {
                                endpoint.setTarget(null);
                                destination = null;
                            }

                        }


                    }
                    else
                    {
                        destination = null;
                    }
                    if(destination != null)
                    {
                        final ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
                        final ReceivingLink_1_0 receivingLink = new ReceivingLink_1_0(new ReceivingLinkAttachment(this, receivingLinkEndpoint), _vhost,
                                (ReceivingDestination) destination);
                        receivingLinkEndpoint.setLinkEventListener(receivingLink);
                        link = receivingLink;
                        if(TerminusDurability.UNSETTLED_STATE.equals(target.getDurable()))
                        {
                            linkRegistry.registerReceivingLink(endpoint.getName(), receivingLink);
                        }
                    }
                }
                else
                {
                    ReceivingLinkEndpoint receivingLinkEndpoint = (ReceivingLinkEndpoint) endpoint;
                    previousLink.setLinkAttachment(new ReceivingLinkAttachment(this, receivingLinkEndpoint));
                    receivingLinkEndpoint.setLinkEventListener(previousLink);
                    link = previousLink;
                    endpoint.setLocalUnsettled(previousLink.getUnsettledOutcomeMap());

                }
            }
View Full Code Here

        return _linkAttachment.getSession().getTransaction(transactionId);
    }

    public Binary getTransactionId()
    {
        SendingLinkEndpoint endpoint = getEndpoint();
        return endpoint == null ? null : endpoint.getTransactionId();
    }
View Full Code Here

            _subscription.suspend();
        }

        _linkAttachment = linkAttachment;

        SendingLinkEndpoint endpoint = linkAttachment.getEndpoint();
        endpoint.setDeliveryStateHandler(this);
        Map initialUnsettledMap = endpoint.getInitialUnsettledMap();
        Map<Binary, QueueEntry> unsettledCopy = new HashMap<Binary, QueueEntry>(_unsettledMap);
        _resumeAcceptedTransfers.clear();
        _resumeFullTransfers.clear();

        for(Map.Entry<Binary, QueueEntry> entry : unsettledCopy.entrySet())
View Full Code Here

                    destination = null;
                }

                if(destination != null)
                {
                    final SendingLinkEndpoint sendingLinkEndpoint = (SendingLinkEndpoint) endpoint;
                    try
                    {
                        final SendingLink_1_0 sendingLink = new SendingLink_1_0(new SendingLinkAttachment(this, sendingLinkEndpoint),
                                                                                _vhost,
                                                                                (SendingDestination) destination
                        );
                        sendingLinkEndpoint.setLinkEventListener(sendingLink);
                        link = sendingLink;
                        if(TerminusDurability.UNSETTLED_STATE.equals(source.getDurable()))
                        {
                            linkRegistry.registerSendingLink(endpoint.getName(), sendingLink);
                        }
                    }
                    catch(AmqpErrorException e)
                    {
                        e.printStackTrace();
                        destination = null;
                        sendingLinkEndpoint.setSource(null);
                        error = e.getError();
                    }
                }
            }
            else
            {
                Source newSource = (Source) endpoint.getSource();

                Source oldSource = (Source) previousLink.getEndpoint().getSource();
                final TerminusDurability newSourceDurable = newSource == null ? null : newSource.getDurable();
                if(newSourceDurable != null)
                {
                    oldSource.setDurable(newSourceDurable);
                    if(newSourceDurable.equals(TerminusDurability.NONE))
                    {
                        linkRegistry.unregisterSendingLink(endpoint.getName());
                    }
                }
                endpoint.setSource(oldSource);
                SendingLinkEndpoint sendingLinkEndpoint = (SendingLinkEndpoint) endpoint;
                previousLink.setLinkAttachment(new SendingLinkAttachment(this, sendingLinkEndpoint));
                sendingLinkEndpoint.setLinkEventListener(previousLink);
                link = previousLink;
                endpoint.setLocalUnsettled(previousLink.getUnsettledOutcomeMap());
            }
        }
        else
View Full Code Here

TOP

Related Classes of org.apache.qpid.amqp_1_0.transport.Predicate

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.