Examples of Waiter


Examples of org.apache.qpid.transport.util.Waiter

    public Session createSession(Binary name, long expiry)
    {
        synchronized (lock)
        {
            Waiter w = new Waiter(lock, timeout);
            while (w.hasTime() && state != OPEN && error == null)
            {
                w.await();               
            }
           
            if (state != OPEN)
            {
                throw new ConnectionException("Timed out waiting for connection to be ready. Current state is :" + state);
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

            switch (state)
            {
            case OPEN:
                state = CLOSING;
                connectionClose(replyCode, replyText, _options);
                Waiter w = new Waiter(lock, timeout);
                while (w.hasTime() && state == CLOSING && error == null)
                {
                    w.await();
                }

                if (error != null)
                {
                    close(replyCode, replyText, _options);
                    throw new ConnectionException(error);
                }

                switch (state)
                {
                case CLOSING:
                    close(replyCode, replyText, _options);
                    throw new ConnectionException("close() timed out");
                case CLOSED:
                    break;
                default:
                    throw new IllegalStateException(String.valueOf(state));
                }
                break;
            case CLOSED:
                break;
            default:
                if (sender != null)
                {
                    sender.close();
                    w = new Waiter(lock, timeout);
                    while (w.hasTime() && sender != null && error == null)
                    {
                        w.await();
                    }

                    if (error != null)
                    {
                        throw new ConnectionException(error);
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

            delegate = new ClientDelegate(vhost, username, password,saslMechs);

            IoTransport.connect(host, port, ConnectionBinding.get(this), ssl);
            send(new ProtocolHeader(1, 0, 10));

            Waiter w = new Waiter(lock, timeout);
            while (w.hasTime() && state == OPENING && error == null)
            {
                w.await();
            }

            if (error != null)
            {
                ConnectionException t = error;
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

            switch (state)
            {
            case OPEN:
                state = CLOSING;
                connectionClose(ConnectionCloseCode.NORMAL, null);
                Waiter w = new Waiter(lock, timeout);
                while (w.hasTime() && state == CLOSING && error == null)
                {
                    w.await();
                }

                if (error != null)
                {
                    close();
                    throw new ConnectionException(error);
                }

                switch (state)
                {
                case CLOSING:
                    close();
                    throw new ConnectionException("close() timed out");
                case CLOSED:
                    break;
                default:
                    throw new IllegalStateException(String.valueOf(state));
                }
                break;
            case CLOSED:
                break;
            default:
                if (sender != null)
                {
                    sender.close();
                    w = new Waiter(lock, timeout);
                    while (w.hasTime() && sender != null && error == null)
                    {
                        w.await();
                    }

                    if (error != null)
                    {
                        throw new ConnectionException(error);
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

                if (state != OPEN && state != CLOSED)
                {
                    Thread current = Thread.currentThread();
                    if (!current.equals(resumer))
                    {
                        Waiter w = new Waiter(commands, timeout);
                        while (w.hasTime() && (state != OPEN && state != CLOSED))
                        {
                            w.await();
                        }
                    }
                }

                switch (state)
                {
                case OPEN:
                    break;
                case RESUMING:
                    Thread current = Thread.currentThread();
                    if (!current.equals(resumer))
                    {
                        throw new SessionException
                            ("timed out waiting for resume to finish");
                    }
                    break;
                case CLOSED:
                    ExecutionException exc = getException();
                    if (exc != null)
                    {
                        throw new SessionException(exc);
                    }
                    else
                    {
                        throw new SessionClosedException();
                    }
                default:
                    throw new SessionException
                        (String.format
                         ("timed out waiting for session to become open " +
                          "(state=%s)", state));
                }

                int next = commandsOut++;
                m.setId(next);

                if (isFull(next))
                {
                    Waiter w = new Waiter(commands, timeout);
                    while (w.hasTime() && isFull(next))
                    {
                        if (state == OPEN || state == RESUMING)
                        {
                            try
                            {
                                sessionFlush(COMPLETED);
                            }
                            catch (SenderException e)
                            {
                                if (expiry > 0)
                                {
                                    // if expiry is > 0 then this will
                                    // happen again on resume
                                    log.error(e, "error sending flush (full replay buffer)");
                                }
                                else
                                {
                                    e.rethrow();
                                }
                            }
                        }
                        w.await();
                    }
                }

                if (isFull(next))
                {
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

            if (needSync && lt(maxComplete, point))
            {
                executionSync(SYNC);
            }

            Waiter w = new Waiter(commands, timeout);
            while (w.hasTime() && state != CLOSED && lt(maxComplete, point))
            {
                log.debug("%s   waiting for[%d]: %d, %s", this, point,
                          maxComplete, commands);
                w.await();
            }

            if (lt(maxComplete, point))
            {
                if (state == CLOSED)
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

            // support it, we should remove this line when there is
            // broker support for full session resume:
            expiry = 0;
            sessionRequestTimeout(0);
            sessionDetach(name.getBytes());
            Waiter w = new Waiter(commands, timeout);
            while (w.hasTime() && state != CLOSED)
            {
                w.await();
            }

            if (state != CLOSED)
            {
                throw new SessionException("close() timed out");
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

        public T get(long timeout)
        {
            synchronized (this)
            {
                Waiter w = new Waiter(this, timeout);
                while (w.hasTime() && state != CLOSED && !isDone())
                {
                    log.debug("%s waiting for result: %s", Session.this, this);
                    w.await();
                }
            }

            if (isDone())
            {
View Full Code Here

Examples of org.apache.qpid.transport.util.Waiter

        send(ssn, "ECHO 8");
        send(ssn, "ECHO 9");

        synchronized (incoming)
        {
            Waiter w = new Waiter(incoming, 30000);
            while (w.hasTime() && incoming.size() < 4)
            {
                w.await();
            }

            assertEquals(4, incoming.size());
            assertEquals("ECHO 1", incoming.get(0).getBodyString());
            assertEquals(0, incoming.get(0).getId());
View Full Code Here

Examples of org.jemmy.timing.Waiter

                    Logger.getLogger(Browser.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }, "FX app launch thread").start();

        new Waiter(new Timeout("launch start waiter", 10000)).ensureState(new State<Boolean>() {
            public Boolean reached() {
                try {
                    Thread.sleep(100); // otherwise mac doesn't start
                } catch (InterruptedException ex) {
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.