Package org.apache.qpid.transport

Examples of org.apache.qpid.transport.ConnectionException


        final String brokerMechanisms = Strings.join(" ", brokerMechs);
        final String restrictionList = getConnectionSettings().getSaslMechs();
        final String selectedMech = CallbackHandlerRegistry.getInstance().selectMechanism(brokerMechanisms, restrictionList);
        if (selectedMech == null)
        {
            throw new ConnectionException("Client and broker have no SASL mechanisms in common." +
                    " Broker allows : " + brokerMechanisms +
                    " Client has : " + CallbackHandlerRegistry.getInstance().getMechanisms()  +
                    " Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
        }
View Full Code Here


        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null || close.getReplyCode() == ConnectionCloseCode.CONNECTION_FORCED)
        {
            _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));

            _qpidConnection.notifyFailoverRequired();

            synchronized (_conn.getFailoverMutex())
            {
                try
                {
                    if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                    {
                        _conn.failoverPrep();
                        _conn.resubscribeSessions();
                        _conn.fireFailoverComplete();
                        return;
                    }
                }
                catch (Exception e)
                {
                    _logger.error("error during failover", e);
                }
                finally
                {
                    _conn.getProtocolHandler().getFailoverLatch().countDown();
                    _conn.getProtocolHandler().setFailoverLatch(null);
                }
            }
        }

        _conn.setClosed();

        ExceptionListener listener = _conn.getExceptionListenerNoCheck();
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

        final String brokerMechanisms = Strings.join(" ", brokerMechs);
        final String restrictionList = getConnectionSettings().getSaslMechs();
        final String selectedMech = CallbackHandlerRegistry.getInstance().selectMechanism(brokerMechanisms, restrictionList);
        if (selectedMech == null)
        {
            throw new ConnectionException("Client and broker have no SASL mechanisms in common." +
                    " Broker allows : " + brokerMechanisms +
                    " Client has : " + CallbackHandlerRegistry.getInstance().getMechanisms()  +
                    " Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
        }
View Full Code Here

        final String brokerMechanisms = Strings.join(" ", brokerMechs);
        final String restrictionList = getConnectionSettings().getSaslMechs();
        final String selectedMech = CallbackHandlerRegistry.getInstance().selectMechanism(brokerMechanisms, restrictionList);
        if (selectedMech == null)
        {
            throw new ConnectionException("Client and broker have no SASL mechanisms in common." +
                    " Broker allows : " + brokerMechanisms +
                    " Client has : " + CallbackHandlerRegistry.getInstance().getMechanisms()  +
                    " Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
        }

        if ((_connectionURL.getUsername() == null || _connectionURL.getPassword() == null)
                && CallbackHandlerRegistry.getInstance().isUserPassRequired(selectedMech))
        {
            throw new ConnectionException("Username and Password is required for the selected mechanism : " + selectedMech +
                    " Broker allows : " + brokerMechanisms +
                    " Client has : " + CallbackHandlerRegistry.getInstance().getMechanisms()  +
                    " Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
        }
View Full Code Here

        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null || close.getReplyCode() == ConnectionCloseCode.CONNECTION_FORCED)
        {
            _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));

            _qpidConnection.notifyFailoverRequired();

            synchronized (_conn.getFailoverMutex())
            {
                try
                {
                    if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                    {
                        _conn.failoverPrep();
                        _conn.resubscribeSessions();
                        _conn.fireFailoverComplete();
                        return;
                    }
                }
                catch (Exception e)
                {
                    _logger.error("error during failover", e);
                }
                finally
                {
                    _conn.getProtocolHandler().getFailoverLatch().countDown();
                    _conn.getProtocolHandler().setFailoverLatch(null);
                }
            }
        }

        _conn.setClosed();

        ExceptionListener listener = _conn.getExceptionListenerNoCheck();
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null)
        {
            _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));
           
            try
            {
                if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                {
                    _conn.failoverPrep();
                    _conn.resubscribeSessions();
                    _conn.fireFailoverComplete();
                    return;
                }
            }
            catch (Exception e)
            {
                _logger.error("error during failover", e);
            }
            finally
            {
                _conn.getProtocolHandler().getFailoverLatch().countDown();
                _conn.getProtocolHandler().setFailoverLatch(null);
            }
        }

        ExceptionListener listener = _conn._exceptionListener;
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null)
        {
            _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));
           
            try
            {
                if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                {
                    _conn.failoverPrep();
                    _conn.resubscribeSessions();
                    _conn.fireFailoverComplete();
                    return;
                }
            }
            catch (Exception e)
            {
                _logger.error("error during failover", e);
            }
            finally
            {
                _conn.getProtocolHandler().getFailoverLatch().countDown();
                _conn.getProtocolHandler().setFailoverLatch(null);
            }
        }

        ExceptionListener listener = _conn._exceptionListener;
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null)
        {
            try
            {
                if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                {
                    _conn.failoverPrep();
                    _qpidConnection.resume();
                    _conn.fireFailoverComplete();
                    return;
                }
            }
            catch (Exception e)
            {
                _logger.error("error during failover", e);
            }
        }

        ExceptionListener listener = _conn._exceptionListener;
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

        final String brokerMechanisms = Strings.join(" ", brokerMechs);
        final String restrictionList = _conSettings.getSaslMechs();
        final String selectedMech = CallbackHandlerRegistry.getInstance().selectMechanism(brokerMechanisms, restrictionList);
        if (selectedMech == null)
        {
            throw new ConnectionException("Client and broker have no SASL mechanisms in common." +
                    " Broker allows : " + brokerMechanisms +
                    " Client has : " + CallbackHandlerRegistry.getInstance().getMechanisms()  +
                    " Client restricted itself to : " + (restrictionList != null ? restrictionList : "no restriction"));
        }
View Full Code Here

        exception = exc;
    }

    public void closed(Connection conn)
    {
        ConnectionException exc = exception;
        exception = null;

        if (exc == null)
        {
            return;
        }

        ConnectionClose close = exc.getClose();
        if (close == null || close.getReplyCode() == ConnectionCloseCode.CONNECTION_FORCED)
        {
            _conn.getProtocolHandler().setFailoverLatch(new CountDownLatch(1));

            _qpidConnection.notifyFailoverRequired();

            synchronized (_conn.getFailoverMutex())
            {
                try
                {
                    if (_conn.firePreFailover(false) && _conn.attemptReconnection())
                    {
                        _conn.failoverPrep();
                        _conn.resubscribeSessions();
                        _conn.fireFailoverComplete();
                        return;
                    }
                }
                catch (Exception e)
                {
                    _logger.error("error during failover", e);
                }
                finally
                {
                    _conn.getProtocolHandler().getFailoverLatch().countDown();
                    _conn.getProtocolHandler().setFailoverLatch(null);
                }
            }
        }

        ExceptionListener listener = _conn._exceptionListener;
        if (listener == null)
        {
            _logger.error("connection exception: " + conn, exc);
        }
        else
        {
            String code = null;
            if (close != null)
            {
                code = close.getReplyCode().toString();
            }

            JMSException ex = new JMSException(exc.getMessage(), code);
            ex.setLinkedException(exc);
            ex.initCause(exc);
            listener.onException(ex);
        }
    }
View Full Code Here

TOP

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

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.