Examples of SenderException


Examples of org.apache.qpid.transport.SenderException

        {
            throw new SenderClosedException("sender is closed", exception);
        }
        if(!senderThread.isAlive())
        {
            throw new SenderException("sender thread not alive");
        }

        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)
                {
                    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;
                    }

                    if (closed.get())
                    {
                        throw new SenderClosedException("sender is closed", exception);
                    }

                    if (head - tail >= size)
                    {
                        throw new SenderException(String.format("write timed out: %s, %s", head, tail));
                    }
                }
                continue;
            }
View Full Code Here

Examples of org.apache.qpid.transport.SenderException

                {
                    senderThread.join(timeout);
                    if (senderThread.isAlive())
                    {
                        log.error("join timed out");
                        throw new SenderException("join timed out");
                    }
                }
            }
            catch (InterruptedException e)
            {
                log.error("interrupted whilst waiting for sender thread to stop");
                throw new SenderException(e);
            }
            finally
            {
                closeListeners();
            }
            if (reportException && exception != null)
            {
                throw new SenderException(exception);
            }
        }
    }
View Full Code Here

Examples of org.apache.qpid.transport.SenderException

            }
        }

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

Examples of org.apache.qpid.transport.SenderException

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

Examples of org.apache.qpid.transport.SenderException

    public void send(ByteBuffer buf)
    {
        if (closed.get())
        {
            throw new SenderException("sender is closed", exception);
        }

        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)
                {
                    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;
                    }

                    if (closed.get())
                    {
                        throw new SenderException("sender is closed", exception);
                    }

                    if (head - tail >= size)
                    {
                        throw new SenderException(String.format("write timed out: %s, %s", head, tail));
                    }
                }
                continue;
            }
View Full Code Here

Examples of org.apache.qpid.transport.SenderException

                if (Thread.currentThread() != this)
                {
                    join(timeout);
                    if (isAlive())
                    {
                        throw new SenderException("join timed out");
                    }
                }
                transport.getReceiver().close(false);
            }
            catch (InterruptedException e)
            {
                throw new SenderException(e);
            }

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

Examples of org.apache.qpid.transport.SenderException

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

        HandshakeStatus handshakeStatus;
        Status status;
       
        while(appData.hasRemaining())
        {       

            int read = 0;
            try
            {
                SSLEngineResult result = engine.wrap(appData, netData);       
                read   = result.bytesProduced();
                status = result.getStatus();
                handshakeStatus = result.getHandshakeStatus();
               
            }
            catch(SSLException e)
            {
                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

Examples of org.apache.qpid.transport.SenderException

                    byte[] out = saslClient.unwrap(netData, 0, length);
                    delegate.received(ByteBuffer.wrap(out));
                }
                catch (SaslException e)
                {
                    throw new SenderException("SASL Sender, Error occurred while encrypting data",e);
                }
            }           
        }
        else
        {
View Full Code Here

Examples of org.apache.qpid.transport.SenderException

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

Examples of org.apache.qpid.transport.SenderException

    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
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.