Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.SenderException


    {
        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


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

            }
        }

        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

            newBuf.flip();
            _appData = newBuf;
        }
        if (closed.get())
        {
            throw new SenderException("SSL Sender is closed");
        }
        doSend();
        if(!appData.hasRemaining())
        {
            _appData = EMPTY_BYTE_BUFFER;
View Full Code Here

                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;
View Full Code Here

                {
                    saslClient.dispose();
                }
                catch (SaslException e)
                {
                    throw new SenderException("Error closing SASL Sender",e);
                }
            }
        }
    }
View Full Code Here

    @Override
    public void send(ByteBuffer buf)
    {       
        if (closed.get())
        {
            throw new SenderException("SSL Sender is closed");
        }
       
        if (isSecurityLayerEstablished())
        {
            while (buf.hasRemaining())
            {
                int length = Math.min(buf.remaining(),sendBuffSize);
                log.debug("sendBuffSize %s", sendBuffSize);
                log.debug("buf.remaining() %s", buf.remaining());
               
                buf.get(appData, 0, length);
                try
                {
                    byte[] out = saslClient.wrap(appData, 0, length);
                    log.debug("out.length %s", out.length);
                   
                    delegate.send(ByteBuffer.wrap(out));
                }
                catch (SaslException e)
                {
                    log.error("Exception while encrypting data.",e);
                    throw new SenderException("SASL Sender, Error occurred while encrypting data",e);
                }
            }           
        }
        else
        {
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.