Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.SenderException


            }
        }

        if (ex != null)
        {
            throw new SenderException(ex.getMessage(), ex);
        }
    }
View Full Code Here


        {
            socket.setSoTimeout(i);
        }
        catch (Exception e)
        {
            throw new SenderException(e);
        }
    }
View Full Code Here

            {
                senderThread.join(timeout);
                if (senderThread.isAlive())
                {
                    log.error("join timed out for socket %s to stop", _remoteSocketAddress);
                    throw new SenderException(String.format("join timed out for socket %s to stop", _remoteSocketAddress));
                }
            }
            catch (InterruptedException e)
            {
                log.error("interrupted whilst waiting for sender thread for socket %s to stop", _remoteSocketAddress);
                throw new SenderException(e);
            }
        }
    }
View Full Code Here

            {
                tearDownSSLConnection();
            }
            catch(Exception e)
            {
                throw new SenderException("Error closing SSL connection",e);
            }


            synchronized(_sslStatus.getSslLock())
            {
View Full Code Here

    public void send(ByteBuffer appData)
    {
        if (closed.get())
        {
            throw new SenderException("SSL Sender is closed");
        }

        HandshakeStatus handshakeStatus;
        Status status;

        while(appData.hasRemaining() && !_sslStatus.getSslErrorFlag())
        {
            int read = 0;
            try
            {
                SSLEngineResult result = engine.wrap(appData, netData);
                read   = result.bytesProduced();
                status = result.getStatus();
                handshakeStatus = result.getHandshakeStatus();
            }
            catch(SSLException e)
            {
                // Should this set _sslError??
                throw new SenderException("SSL, Error occurred while encrypting data",e);
            }

            if(read > 0)
            {
                int limit = netData.limit();
                netData.limit(netData.position());
                netData.position(netData.position() - read);

                ByteBuffer data = netData.slice();

                netData.limit(limit);
                netData.position(netData.position() + read);

                delegate.send(data);
            }

            switch(status)
            {
                case CLOSED:
                    throw new SenderException("SSLEngine is closed");

                case BUFFER_OVERFLOW:
                    netData.clear();
                    continue;

                case OK:
                    break; // do nothing

                default:
                    throw new IllegalStateException("SSLReceiver: Invalid State " + status);
            }

            switch (handshakeStatus)
            {
                case NEED_WRAP:
                    if (netData.hasRemaining())
                    {
                        continue;
                    }

                case NEED_TASK:
                    doTasks();
                    break;

                case NEED_UNWRAP:
                    flush();
                    synchronized(_sslStatus.getSslLock())
                    {
                        if (_sslStatus.getSslErrorFlag())
                        {
                            break;
                        }

                        switch (engine.getHandshakeStatus())
                        {
                        case NEED_UNWRAP:
                            final long start = System.currentTimeMillis();
                            try
                            {
                                _sslStatus.getSslLock().wait(timeout);
                            }
                            catch(InterruptedException e)
                            {
                                // pass
                            }

                            if (!_sslStatus.getSslErrorFlag() && System.currentTimeMillis() - start >= timeout)
                            {                               
                                throw new SenderException(
                                                          "SSL Engine timed out after waiting " + timeout + "ms. for a response." +
                                                          "To get more info,run with -Djavax.net.debug=ssl");
                            }
                            break;
                        }
View Full Code Here

    {
        checkNotAlreadyClosed();

        if(!senderThread.isAlive())
        {
            throw new SenderException(String.format("sender thread for socket %s is not alive", _remoteSocketAddress));
        }

        final int size = buffer.length;
        int remaining = buf.remaining();

        while (remaining > 0)
        {
            final int hd = head;
            final int tl = tail;

            if (hd - tl >= size)
            {
                flush();
                synchronized (notFull)
                {
                    final long start = System.currentTimeMillis();
                    long elapsed = 0;
                    while (!closed.get() && head - tail >= size && elapsed < timeout)
                    {
                        try
                        {
                            notFull.wait(timeout - elapsed);
                        }
                        catch (InterruptedException e)
                        {
                            // pass
                        }
                        elapsed = System.currentTimeMillis() - start;
                    }

                    checkNotAlreadyClosed();

                    if (head - tail >= size)
                    {
                        try
                        {
                            log.error("write timed out for socket %s: head %d, tail %d", _remoteSocketAddress, head, tail);
                            throw new SenderException(String.format("write timed out for socket %s: head %d, tail %d",  _remoteSocketAddress, head, tail));
                        }
                        finally
                        {
                            close(false, false);
                        }
View Full Code Here

            {
                closeReceiver();
            }
            if (reportException && exception != null)
            {
                throw new SenderException(exception);
            }
        }
    }
View Full Code Here

                _receiver.close();
            }
            catch(RuntimeException e)
            {
                log.error(e, "Exception closing receiver for socket %s", _remoteSocketAddress);
                throw new SenderException(e.getMessage(), e);
            }
        }
    }
View Full Code Here

        {
            socket.setSoTimeout(i);
        }
        catch (Exception e)
        {
            throw new SenderException(e);
        }
    }
View Full Code Here

            {
                senderThread.join(timeout);
                if (senderThread.isAlive())
                {
                    log.error("join timed out for socket %s to stop", _remoteSocketAddress);
                    throw new SenderException(String.format("join timed out for socket %s to stop", _remoteSocketAddress));
                }
            }
            catch (InterruptedException e)
            {
                log.error("interrupted whilst waiting for sender thread for socket %s to stop", _remoteSocketAddress);
                throw new SenderException(e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.transport.SenderException

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.