public void run()

in client/src/main/java/org/apache/qpid/transport/network/io/IoSender.java [261:343]


    public void run()
    {
        final int size = buffer.length;
        while (true)
        {
            final int hd = head;
            final int tl = tail;

            if (hd == tl)
            {
                if (closed.get())
                {
                    break;
                }

                idle = true;

                synchronized (notEmpty)
                {
                    while (head == tail && !closed.get())
                    {
                        try
                        {
                            notEmpty.wait();
                        }
                        catch (InterruptedException e)
                        {
                            // pass
                        }
                    }
                }

                idle = false;

                continue;
            }

            final int hd_idx = mod(hd, size);
            final int tl_idx = mod(tl, size);

            final int length;
            if (tl_idx < hd_idx)
            {
                length = hd_idx - tl_idx;
            }
            else
            {
                length = size - tl_idx;
            }

            try
            {
                out.write(buffer, tl_idx, length);
            }
            catch (IOException e)
            {
                LOGGER.info("Exception in thread sending for socket '{}' : {}", _socketEndpointDescription, e.getMessage());
                exception = e;
                close(false, false);
                break;
            }
            tail += length;
            if (head - tl >= size)
            {
                synchronized (notFull)
                {
                    notFull.notify();
                }
            }
        }

        if (!shutdownBroken && !(socket instanceof SSLSocket))
        {
            try
            {
                socket.shutdownOutput();
            }
            catch (IOException e)
            {
                //pass
            }
        }
    }