Package org.apache.activemq.command

Examples of org.apache.activemq.command.ExceptionResponse


                while (true) {
                    timeout = flowControlTimeoutMessages.take();
                    if (timeout != null) {
                        synchronized (messagesWaitingForSpace) {
                            if (messagesWaitingForSpace.remove(timeout.message.getMessageId()) != null) {
                                ExceptionResponse response = new ExceptionResponse(
                                        new ResourceAllocationException(
                                                "Usage Manager Memory Limit reached. Stopping producer ("
                                                        + timeout.message.getProducerId()
                                                        + ") to prevent flooding "
                                                        + getActiveMQDestination().getQualifiedName()
                                                        + "."
                                                        + " See http://activemq.apache.org/producer-flow-control.html for more info"));
                                response.setCorrelationId(timeout.message.getCommandId());
                                timeout.context.getConnection().dispatchAsync(response);
                            }
                        }
                    }
                }
View Full Code Here


            public void handle(Response response) throws Exception {

                Iq result = createResult(iq);

                if (response instanceof ExceptionResponse) {
                    ExceptionResponse exceptionResponse = (ExceptionResponse)response;
                    Throwable exception = exceptionResponse.getException();

                    LOG.warn("Failed to create connection: " + exception, exception);

                    Error error = new Error();
                    result.setError(error);
View Full Code Here

    protected Handler<Response> createErrorHandler(final String text) {
        return new Handler<Response>() {
            public void handle(Response event) throws Exception {
                if (event instanceof ExceptionResponse) {
                    ExceptionResponse exceptionResponse = (ExceptionResponse)event;
                    Throwable exception = exceptionResponse.getException();
                    LOG.error("Failed to " + text + ". Reason: " + exception, exception);
                } else if (LOG.isDebugEnabled()) {
                    LOG.debug("Completed " + text);
                }
            }
View Full Code Here

                                        context.getConnection().dispatchAsync(response);
                                    }
   
                                } catch (Exception e) {
                                    if (!sendProducerAck && !context.isInRecoveryMode()) {
                                        ExceptionResponse response = new ExceptionResponse(e);
                                        response.setCorrelationId(message.getCommandId());
                                        context.getConnection().dispatchAsync(response);
                                    }
                                }
                            }
                        });
View Full Code Here

                                        context.getConnection().dispatchAsync(response);
                                    }
   
                                } catch (Exception e) {
                                    if (!sendProducerAck && !context.isInRecoveryMode()) {
                                        ExceptionResponse response = new ExceptionResponse(e);
                                        response.setCorrelationId(message.getCommandId());
                                        context.getConnection().dispatchAsync(response);
                                    }
                                }
                               
                            }
View Full Code Here

        } else {

            try {
                Response response = (Response)this.transport.request(command);
                if (response.isException()) {
                    ExceptionResponse er = (ExceptionResponse)response;
                    if (er.getException() instanceof JMSException) {
                        throw (JMSException)er.getException();
                    } else {
                        if (isClosed()||closing.get()) {
                            LOG.debug("Received an exception but connection is closing");
                        }
                        JMSException jmsEx = null;
                        try {
                         jmsEx = JMSExceptionSupport.create(er.getException());
                        }catch(Throwable e) {
                            LOG.error("Caught an exception trying to create a JMSException for " +er.getException(),e);
                        }
                        if(jmsEx !=null) {
                            throw jmsEx;
                        }
                    }
View Full Code Here

  private Response doSyncSendPacket(Command command, int timeout)
      throws JMSException {
    try {
        Response response = (Response)this.transport.request(command, timeout);
        if (response != null && response.isException()) {
            ExceptionResponse er = (ExceptionResponse)response;
            if (er.getException() instanceof JMSException) {
                throw (JMSException)er.getException();
            } else {
                throw JMSExceptionSupport.create(er.getException());
            }
        }
        return response;
    } catch (IOException e) {
        throw JMSExceptionSupport.create(e);
View Full Code Here

            }
        }
        if( requests!=null ) {
            for (Iterator<FutureResponse> iter = requests.iterator(); iter.hasNext();) {
                FutureResponse fr = iter.next();
                fr.set(new ExceptionResponse(error));
            }
        }
    }
View Full Code Here

            if (SERVICELOG.isDebugEnabled() && e.getClass() != BrokerStoppedException.class) {
                SERVICELOG.debug("Error occured while processing " + (responseRequired ? "sync" : "async")
                        + " command: " + command + ", exception: " + e, e);
            }
            if (responseRequired) {
                response = new ExceptionResponse(e);
            } else {
                serviceException(e);
            }
        }
        if (responseRequired) {
View Full Code Here

        // if the broker service has slave attached, wait for the slave to be
        // attached to allow client connection. slave connection is fine
        if (!info.isBrokerMasterConnector() && connector.getBrokerService().isWaitForSlave()
                && connector.getBrokerService().getSlaveStartSignal().getCount() == 1) {
            ServiceSupport.dispose(transport);
            return new ExceptionResponse(new Exception("Master's slave not attached yet."));
        }
        // Older clients should have been defaulting this field to true.. but
        // they were not.
        if (wireFormatInfo != null && wireFormatInfo.getVersion() <= 2) {
            info.setClientMaster(true);
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.ExceptionResponse

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.