Example usage for javax.jms JMSException getMessage

List of usage examples for javax.jms JMSException getMessage

Introduction

In this page you can find the example usage for javax.jms JMSException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.googlecode.fascinator.portal.HouseKeeper.java

/**
 * Stop the House Keeper. Including stopping the storage and indexer
 *//*from w w  w .  j  av a 2 s. co  m*/
@Override
public void stop() throws Exception {
    openLog();
    log.info("Stopping House Keeping object...");
    timer.cancel();
    if (indexer != null) {
        try {
            indexer.shutdown();
        } catch (PluginException pe) {
            log.error("Failed to shutdown indexer: {}", pe.getMessage());
            closeLog();
            throw pe;
        }
    }
    if (storage != null) {
        try {
            storage.shutdown();
        } catch (PluginException pe) {
            log.error("Failed to shutdown storage: {}", pe.getMessage());
            closeLog();
            throw pe;
        }
    }
    if (consumer != null) {
        try {
            consumer.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close consumer: {}", jmse.getMessage());
            closeLog();
            throw jmse;
        }
    }
    if (cSession != null) {
        try {
            cSession.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close consumer session: {}", jmse);
        }
    }
    if (pSession != null) {
        try {
            pSession.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close consumer session: {}", jmse);
        }
    }
    if (connection != null) {
        try {
            connection.close();
        } catch (JMSException jmse) {
            log.warn("Failed to close connection: {}", jmse);
        }
    }

    // Derby can only be shutdown from one thread,
    // we'll catch errors from the rest.
    String threadedShutdownMessage = DERBY_DRIVER + " is not registered with the JDBC driver manager";
    try {
        // Tell the database to close
        DriverManager.getConnection(DERBY_PROTOCOL + ";shutdown=true");
        // Shutdown just this database (but not the engine)
        // DriverManager.getConnection(DERBY_PROTOCOL + SECURITY_DATABASE +
        // ";shutdown=true");
    } catch (SQLException ex) {
        // These test values are used if the engine is NOT shutdown
        // if (ex.getErrorCode() == 45000 &&
        // ex.getSQLState().equals("08006")) {

        // Valid response
        if (ex.getErrorCode() == 50000 && ex.getSQLState().equals("XJ015")) {
            // Error response
        } else {
            // Make sure we ignore simple thread issues
            if (!ex.getMessage().equals(threadedShutdownMessage)) {
                log.warn("Error during database shutdown:", ex);
            }
        }
    } finally {
        try {
            // Close our connection
            if (dbConnection != null) {
                dbConnection.close();
                dbConnection = null;
            }
        } catch (SQLException ex) {
            log.warn("Error closing connection:", ex);
        }
    }

    // Shutdown the scheduler
    if (scheduler != null) {
        try {
            scheduler.shutdown();
        } catch (SchedulerException ex) {
            log.warn("Failed to close connection: {}", ex);
        }
    }

    closeLog();
}

From source file:com.googlecode.fascinator.portal.HouseKeeper.java

/**
 * Callback function for incoming messages sent directly to housekeeping.
 * /* w ww  .  j a  va 2 s  .c  om*/
 * @param message The incoming message
 */
@Override
public void onMessage(Message message) {
    openLog();
    try {
        // Make sure thread priority is correct
        if (!Thread.currentThread().getName().equals(thread.getName())) {
            Thread.currentThread().setName(thread.getName());
            Thread.currentThread().setPriority(thread.getPriority());
        }

        String text = ((TextMessage) message).getText();
        JsonSimple msgJson = new JsonSimple(text);
        // log.debug("Message\n{}", msgJson.toString());

        String msgType = msgJson.getString(null, "type");
        if (msgType == null) {
            log.error("No message type set!");
            closeLog();
            return;
        }

        // Stop the system from working until a restart occurs
        if (msgType.equals("blocking-restart")) {
            UserAction ua = new UserAction();
            ua.block = true;
            ua.message = "Changes made to the system require a restart. "
                    + "Please restart the system before normal " + "functionality can resume.";
            storeAction(ua);
        }

        // Request a restart, not required though
        if (msgType.equals("basic-restart")) {
            UserAction ua = new UserAction();
            ua.block = false;
            ua.message = "Changes made to the system require a restart.";
            storeAction(ua);
        }

        // Harvest file update
        if (msgType.equals("harvest-update")) {
            String oid = msgJson.getString(null, "oid");
            if (oid != null) {
                UserAction ua = new UserAction();
                ua.block = false;
                ua.message = ("A harvest file has been updated: '" + oid + "'");
                storeAction(ua);
            } else {
                log.error("Invalid message, no harvest file OID provided!");
            }
        }

        // User notications
        if (msgType.equals("user-notice")) {
            String messageText = msgJson.getString(null, "message");
            if (messageText != null) {
                UserAction ua = new UserAction();
                ua.block = false;
                ua.message = messageText;
                storeAction(ua);
            } else {
                log.error("Invalid notice, no message text provided!");
            }
        }

        // Statistics update from Broker Monitor
        if (msgType.equals("broker-update")) {
            Map<String, JsonSimple> queues = JsonSimple.toJavaMap(msgJson.getObject("stats"));
            for (String q : queues.keySet()) {
                JsonSimple qData = queues.get(q);
                Map<String, String> qStats = new HashMap<String, String>();
                qStats.put("total", qData.getString(null, "total"));
                qStats.put("lost", qData.getString(null, "lost"));
                qStats.put("memory", qData.getString(null, "memory"));
                qStats.put("size", qData.getString(null, "size"));
                // Round to an integer value
                int spd = Float.valueOf(qData.getString("0.0", "speed")).intValue();
                qStats.put("speed", String.valueOf(spd));
                // Change from milliseconds to seconds
                float avg = Float.valueOf(qData.getString("0.0", "average")) / 1000;
                // Round to two digits
                avg = Math.round(avg * 100) / 100;
                qStats.put("average", String.valueOf(avg));
                stats.put(q, qStats);
            }
        }

        // 'Refresh' received, check config and reset timer
        if (msgType.equals("refresh")) {
            log.info("Refreshing House Keeping");
            globalConfig = new JsonSimpleConfig();
            timeout = globalConfig.getInteger(DEFAULT_TIMEOUT, "portal", "houseKeeping", "config", "frequency");
            log.info("Starting callback timer. Timeout = {}s", timeout);
            timer.cancel();
            timer = new Timer("HouseKeeping", true);
            timer.scheduleAtFixedRate(new TimerTask() {
                @Override
                public void run() {
                    onTimeout();
                }
            }, 0, timeout * 1000);

            // Show a message for the user
            UserAction ua = new UserAction();
            ua.block = false;
            ua.message = ("House Keeping is restarting. Frequency = " + timeout + "s");
            storeAction(ua);
        }
    } catch (JMSException jmse) {
        log.error("Failed to receive message: {}", jmse.getMessage());
    } catch (IOException ioe) {
        log.error("Failed to parse message: {}", ioe.getMessage());
    }
    closeLog();
}

From source file:com.cognifide.aet.worker.listeners.CollectorMessageListenerImpl.java

@Override
public void onMessage(final Message message) {
    CollectorJobData collectorJobData = null;
    try {// w  w  w .j  a  v  a2 s. c om
        collectorJobData = JmsUtils.getFromMessage(message, CollectorJobData.class);
    } catch (JMSException e) {
        LOGGER.error("Invalid message obtained!", e);
    }
    String correlationId = JmsUtils.getJMSCorrelationID(message);
    String requestMessageId = JmsUtils.getJMSMessageID(message);
    if (collectorJobData != null && StringUtils.isNotBlank(correlationId) && requestMessageId != null) {
        LOGGER.info(
                "CollectorJobData [{}] message arrived with {} urls. CorrelationId: {} RequestMessageId: {}",
                name, collectorJobData.getUrls().size(), correlationId, requestMessageId);
        WebCommunicationWrapper webCommunicationWrapper = null;
        int collected = 0;
        try {
            //FIXME - proxy is now set per url
            final String usedProxy = collectorJobData.getUrls().get(0).getProxy();
            if (isProxyUsed(usedProxy)) {
                webCommunicationWrapper = this.webDriverProvider.createWebDriverWithProxy(webDriverName,
                        usedProxy);
            } else {
                webCommunicationWrapper = this.webDriverProvider.createWebDriver(webDriverName);
            }
            collected = runUrls(collectorJobData, requestMessageId, webCommunicationWrapper, correlationId);

        } catch (WorkerException e) {
            for (Url url : collectorJobData.getUrls()) {
                String errorMessage = String.format("Couldn't process following url `%s` because of error: %s",
                        url.getUrl(), e.getMessage());
                LOGGER.error(errorMessage, e);
                CollectorResultData collectorResultData = CollectorResultData.createErrorResult(url,
                        ProcessingError.collectingError(errorMessage), requestMessageId,
                        collectorJobData.getTestName());
                feedbackQueue.sendObjectMessageWithCorrelationID(collectorResultData, correlationId);
            }
        } finally {
            quitWebDriver(webCommunicationWrapper);
        }
        LOGGER.info("Successfully collected from {}/{} urls.", collected, collectorJobData.getUrls().size());
    }

}

From source file:org.springframework.integration.jms.JmsOutboundGateway.java

private javax.jms.Message retryableReceiveReply(Session session, Destination replyTo, String messageSelector)
        throws JMSException {
    Connection consumerConnection = null; //NOSONAR
    Session consumerSession = session;//from   w  w w .j a  v a 2  s  . c  om
    MessageConsumer messageConsumer = null;
    JMSException exception = null;
    boolean isTemporaryReplyTo = replyTo instanceof TemporaryQueue || replyTo instanceof TemporaryTopic;
    long replyTimeout = isTemporaryReplyTo ? Long.MIN_VALUE
            : this.receiveTimeout < 0 ? Long.MAX_VALUE : System.currentTimeMillis() + this.receiveTimeout;
    try {
        do {
            try {
                messageConsumer = consumerSession.createConsumer(replyTo, messageSelector);
                javax.jms.Message reply = receiveReplyMessage(messageConsumer);
                if (reply == null) {
                    if (replyTimeout > System.currentTimeMillis()) {
                        throw new JMSException("Consumer closed before timeout");
                    }
                }
                return reply;
            } catch (JMSException e) {
                exception = e;
                if (logger.isDebugEnabled()) {
                    logger.debug("Connection lost waiting for reply, retrying: " + e.getMessage());
                }
                do {
                    try {
                        consumerConnection = createConnection();
                        consumerSession = createSession(consumerConnection);
                        break;
                    } catch (JMSException ee) {
                        exception = ee;
                        if (logger.isDebugEnabled()) {
                            logger.debug("Could not reconnect, retrying: " + ee.getMessage());
                        }
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e1) {
                            Thread.currentThread().interrupt();
                            return null;
                        }
                    }
                } while (replyTimeout > System.currentTimeMillis());
            }
        } while (replyTimeout > System.currentTimeMillis());
        if (isTemporaryReplyTo) {
            return null;
        } else {
            throw exception;
        }
    } finally {
        if (consumerSession != session) {
            JmsUtils.closeSession(consumerSession);
            JmsUtils.closeConnection(consumerConnection);
        }
        JmsUtils.closeMessageConsumer(messageConsumer);
    }
}

From source file:com.cognifide.aet.worker.listeners.ComparatorMessageListenerImpl.java

@Override
public void onMessage(final Message message) {
    ComparatorJobData comparatorJobData = null;
    try {/*from  www .  ja va 2  s  .c  o  m*/
        comparatorJobData = JmsUtils.getFromMessage(message, ComparatorJobData.class);
    } catch (JMSException e) {
        LOGGER.error("Invalid message obtained!", e);
    }
    String jmsCorrelationId = JmsUtils.getJMSCorrelationID(message);

    if (comparatorJobData != null && StringUtils.isNotBlank(jmsCorrelationId)) {
        LOGGER.info("ComparatorJobData  [{}] message arrived. CorrelationId: {} TestName: {} UrlName: {}",
                jmsCorrelationId, comparatorJobData.getTestName(), comparatorJobData.getUrlName());
        final Step step = comparatorJobData.getStep();
        final ComparatorProperties properties = new ComparatorProperties(comparatorJobData.getCompany(),
                comparatorJobData.getProject(), step.getPattern(), step.getStepResult().getArtifactId());

        for (Comparator comparator : step.getComparators()) {
            LOGGER.info("Start comparison for comparator {} in step {}", comparator, step);
            ComparatorResultData.Builder resultBuilder = ComparatorResultData.newBuilder(
                    comparatorJobData.getTestName(), comparatorJobData.getUrlName(), step.getIndex());
            try {
                Comparator processedComparator = dispatcher.run(comparator, properties);
                LOGGER.info("Comparison successfully ended. CorrelationId: {} TestName: {} Comparator: {}",
                        jmsCorrelationId, comparatorJobData.getTestName(), comparatorJobData.getUrlName(),
                        comparator);
                resultBuilder.withComparisonResult(processedComparator).withStatus(JobStatus.SUCCESS);
            } catch (Exception e) {
                LOGGER.error("Exception during compare. CorrelationId: {}", jmsCorrelationId, e);
                final ComparatorStepResult errorResult = new ComparatorStepResult(null,
                        ComparatorStepResult.Status.PROCESSING_ERROR);
                errorResult.addError(e.getMessage());
                comparator.setStepResult(errorResult);
                resultBuilder.withStatus(JobStatus.ERROR).withComparisonResult(comparator)
                        .withProcessingError(ProcessingError.comparingError(e.getMessage()));
            }
            feedbackQueue.sendObjectMessageWithCorrelationID(resultBuilder.build(), jmsCorrelationId);
        }

    }
}

From source file:nl.nn.adapterframework.extensions.ifsa.jms.PullingIfsaProviderListener.java

public void afterMessageProcessed(PipeLineResult plr, Object rawMessage, Map threadContext)
        throws ListenerException {

    try {/*www  . j a v  a  2s  . c o  m*/
        if (isJmsTransacted() && !(getMessagingSource().isXaEnabledForSure() && JtaUtil.inTransaction())) {
            QueueSession session = (QueueSession) threadContext.get(THREAD_CONTEXT_SESSION_KEY);

            try {
                session.commit();
            } catch (JMSException e) {
                log.error(getLogPrefix() + "got error committing the received message", e);
            }
            if (isSessionsArePooled()) {
                threadContext.remove(THREAD_CONTEXT_SESSION_KEY);
                releaseSession(session);
            }
        }
    } catch (Exception e) {
        log.error(getLogPrefix() + "exception in closing or releasing session", e);
    }
    // on request-reply send the reply.
    if (getMessageProtocolEnum().equals(IfsaMessageProtocolEnum.REQUEST_REPLY)) {
        Message originalRawMessage;
        if (rawMessage instanceof Message) {
            originalRawMessage = (Message) rawMessage;
        } else {
            originalRawMessage = (Message) threadContext.get(THREAD_CONTEXT_ORIGINAL_RAW_MESSAGE_KEY);
        }
        if (originalRawMessage == null) {
            String id = (String) threadContext.get(IPipeLineSession.messageIdKey);
            String cid = (String) threadContext.get(IPipeLineSession.businessCorrelationIdKey);
            log.warn(getLogPrefix() + "no original raw message found for messageId [" + id + "] correlationId ["
                    + cid + "], cannot send result");
        } else {
            QueueSession session = getSession(threadContext);
            try {
                String result = "<exception>no result</exception>";
                if (plr != null && plr.getResult() != null) {
                    result = plr.getResult();
                }
                sendReply(session, originalRawMessage, result);
            } catch (IfsaException e) {
                try {
                    sendReply(session, originalRawMessage, "<exception>" + e.getMessage() + "</exception>");
                } catch (IfsaException e2) {
                    log.warn(getLogPrefix() + "exception sending errormessage as reply", e2);
                }
                throw new ListenerException(getLogPrefix() + "Exception on sending result", e);
            } finally {
                releaseSession(session);
            }
        }
    }
}

From source file:DurableChat.java

public void DurableChatter(String broker, String username, String password) {
    javax.jms.MessageProducer publisher = null;
    javax.jms.MessageConsumer subscriber = null;
    javax.jms.Topic topic = null;/*w w w. ja va2  s .  c  o m*/

    //Create a connection:
    try {
        javax.jms.ConnectionFactory factory;
        factory = new ActiveMQConnectionFactory(username, password, broker);
        connection = factory.createConnection(username, password);

        //Durable Subscriptions are indexed by username, clientID and subscription name
        //It is a good practice to set the clientID:
        connection.setClientID(username);
        pubSession = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
        subSession = connection.createSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE);
    } catch (javax.jms.JMSException jmse) {
        System.err.println("Error: Cannot connect to Broker - " + broker);
        jmse.printStackTrace();
        System.exit(1);
    }

    //Create Publisher and Durable Subscriber:
    try {

        topic = pubSession.createTopic(APP_TOPIC);
        subscriber = subSession.createDurableSubscriber(topic, username);
        subscriber.setMessageListener(this);
        publisher = pubSession.createProducer(topic);
        connection.start();
    } catch (javax.jms.JMSException jmse) {
        System.out.println("Error: connection not started.");
        jmse.printStackTrace();
        System.exit(1);
    }

    //Wait for user input
    try {
        System.out.println("\nDurableChat application:\n" + "========================\n" + "The user "
                + username + " connects to the broker at " + DEFAULT_BROKER_NAME + ".\n"
                + "The application will publish messages to the " + APP_TOPIC + " topic.\n"
                + "The application also creates a durable subscription to that topic to consume any messages published there.\n\n"
                + "Type some text, and then press Enter to publish it as a TextMesssage from " + username
                + ".\n");
        java.io.BufferedReader stdin = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
        while (true) {
            String s = stdin.readLine();

            if (s == null) {
                exit();
            } else if (s.length() > 0) {
                try {
                    javax.jms.TextMessage msg = pubSession.createTextMessage();
                    msg.setText(username + ": " + s);
                    //Publish the message persistantly:
                    publisher.send(msg, //message
                            javax.jms.DeliveryMode.PERSISTENT, //publish persistently
                            javax.jms.Message.DEFAULT_PRIORITY, //priority
                            MESSAGE_LIFESPAN); //Time to Live
                } catch (javax.jms.JMSException jmse) {
                    System.err.println("Error publishing message:" + jmse.getMessage());
                }
            }
        }
    } catch (java.io.IOException ioe) {
        ioe.printStackTrace();
    }
}

From source file:org.wso2.carbon.inbound.endpoint.protocol.jms.JMSPollingConsumer.java

/**
 * Create connection with broker and retrieve the messages. Then inject
 * according to the registered handler//  w  ww. j av a 2  s  .  c  o m
 */
public Message poll() {
    logger.debug("Polling JMS messages.");

    try {
        connection = jmsConnectionFactory.getConnection(strUserName, strPassword);
        if (connection == null) {
            logger.warn("Inbound JMS endpoint unable to get a connection.");
            isConnected = false;
            return null;
        }
        if (retryIteration != 0) {
            logger.info("Reconnection attempt: " + retryIteration + " for the JMS Inbound: " + name
                    + " was successful!");
            this.retryIteration = 0;
            this.retryDuration = 1;
        }
        isConnected = true;
        session = jmsConnectionFactory.getSession(connection);
        //Fixing ESBJAVA-4446
        //Closing the connection if we cannot get a session.
        //Then in the next poll iteration it will create a new connection
        //instead of using cached connection
        if (session == null) {
            logger.warn("Inbound JMS endpoint unable to get a session.");
            jmsConnectionFactory.closeConnection();
            return null;
        }
        destination = jmsConnectionFactory.getDestination(session);
        if (replyDestinationName != null && !replyDestinationName.trim().equals("")) {
            if (logger.isDebugEnabled()) {
                logger.debug(
                        "Using the reply destination as " + replyDestinationName + " in inbound endpoint.");
            }
            replyDestination = jmsConnectionFactory.createDestination(session, replyDestinationName);
        }
        messageConsumer = jmsConnectionFactory.getMessageConsumer(session, destination);
        Message msg = receiveMessage(messageConsumer);
        if (msg == null) {
            logger.debug("Inbound JMS Endpoint. No JMS message received.");
            return null;
        }
        while (msg != null) {
            if (!JMSUtils.inferJMSMessageType(msg).equals(TextMessage.class.getName())) {
                logger.error("JMS " + "Inbound transport support JMS TextMessage type only. Found message type "
                        + JMSUtils.inferJMSMessageType(msg));
                return null;
            }

            if (injectHandler != null) {

                boolean commitOrAck = true;
                // Set the reply destination and connection
                if (replyDestination != null) {
                    injectHandler.setReplyDestination(replyDestination);
                }
                injectHandler.setConnection(connection);
                commitOrAck = injectHandler.invoke(msg, name);
                // if client acknowledgement is selected, and processing
                // requested ACK
                if (jmsConnectionFactory.getSessionAckMode() == Session.CLIENT_ACKNOWLEDGE) {
                    if (commitOrAck) {
                        try {
                            msg.acknowledge();
                            if (logger.isDebugEnabled()) {
                                logger.debug("Message : " + msg.getJMSMessageID() + " acknowledged");
                            }
                        } catch (JMSException e) {
                            logger.error("Error acknowledging message : " + msg.getJMSMessageID(), e);
                        }
                    } else {
                        // Need to create a new consumer and session since
                        // we need to rollback the message
                        if (messageConsumer != null) {
                            jmsConnectionFactory.closeConsumer(messageConsumer);
                        }
                        if (session != null) {
                            jmsConnectionFactory.closeSession(session);
                        }
                        session = jmsConnectionFactory.getSession(connection);
                        messageConsumer = jmsConnectionFactory.getMessageConsumer(session, destination);
                    }
                }
                // if session was transacted, commit it or rollback
                if (jmsConnectionFactory.isTransactedSession()) {
                    try {
                        if (session.getTransacted()) {
                            if (commitOrAck) {
                                session.commit();
                                if (logger.isDebugEnabled()) {
                                    logger.debug(
                                            "Session for message : " + msg.getJMSMessageID() + " committed");
                                }
                            } else {
                                session.rollback();
                                if (logger.isDebugEnabled()) {
                                    logger.debug(
                                            "Session for message : " + msg.getJMSMessageID() + " rolled back");
                                }
                            }
                        }
                    } catch (JMSException e) {
                        logger.error("Error " + (commitOrAck ? "committing" : "rolling back")
                                + " local session txn for message : " + msg.getJMSMessageID(), e);
                    }
                }
            } else {
                return msg;
            }
            msg = receiveMessage(messageConsumer);
        }

    } catch (JMSException e) {
        logger.error("Error while receiving JMS message. " + e.getMessage(), e);
    } catch (Exception e) {
        logger.error("Error while receiving JMS message. " + e.getMessage(), e);
    } finally {
        if (!isConnected) {
            if (reconnectDuration != null) {
                retryDuration = reconnectDuration;
                logger.error("Reconnection attempt : " + (retryIteration++) + " for JMS Inbound : " + name
                        + " failed. Next retry in " + (retryDuration / 1000) + " seconds. (Fixed Interval)");
            } else {
                retryDuration = (long) (retryDuration * reconnectionProgressionFactor);
                if (retryDuration > maxReconnectDuration) {
                    retryDuration = maxReconnectDuration;
                    logger.info("InitialReconnectDuration reached to MaxReconnectDuration.");
                }
                logger.error("Reconnection attempt : " + (retryIteration++) + " for JMS Inbound : " + name
                        + " failed. Next retry in " + (retryDuration / 1000) + " seconds");
            }
            try {
                Thread.sleep(retryDuration);
            } catch (InterruptedException ignore) {
            }
        }
        if (messageConsumer != null) {
            jmsConnectionFactory.closeConsumer(messageConsumer);
        }
        if (session != null) {
            jmsConnectionFactory.closeSession(session);
        }
        if (connection != null) {
            jmsConnectionFactory.closeConnection(connection);
        }
    }
    return null;
}

From source file:com.MainFiles.Functions.java

public HashMap getWeblogicMessageFromQueue(String JMSCorrelationID) {

    String url = AGENCY_ADAPTER_URL;
    String QUEUE = QUEUE_RESPONSE;
    Message msg = null;// w w w . j  a v  a  2  s .co  m
    Object ResponseMessage = null;
    HashMap fields = new HashMap();
    int loops = 1;
    try {
        while (true) {
            if (loops > 5) {
                break;
            }

            DistributedWebLogicQueueBrowser distrWebLogic = new DistributedWebLogicQueueBrowser();
            msg = distrWebLogic.browseWebLogicQueue(JMSCorrelationID, url, QUEUE);
            if (msg instanceof ObjectMessage) {
                ResponseMessage = ((ObjectMessage) msg).getObject();
                fields = (HashMap) ResponseMessage;
                this.log("RESPONSE ::  " + JMSCorrelationID + "\n" + fields.toString() + "\n\n",
                        "ESB_Response");
                break;
            }
            distrWebLogic = null;
            loops++;
        }
    } catch (JMSException ex) {
        this.log("Error getWeblogicMessageFromUDQueue() " + ex.getMessage() + "\n" + this.StackTraceWriter(ex),
                "error--");
    }
    return fields;
}

From source file:com.globalsight.everest.workflowmanager.WorkflowManagerLocal.java

/**
 * For GBS-495, "Discard" Job(s) took long time to complete especially if
 * the job contain large files or too many files.
 * /*from   www .  j  av  a2 s  . co m*/
 * @param p_job
 * @param reimport
 */
@SuppressWarnings("unchecked")
private void cancel(Job p_job, boolean reimport) {
    JobImpl job = HibernateUtil.get(JobImpl.class, new Long(p_job.getId()));
    String oldState = job.getState();
    job.setState(Job.CANCELLED);
    HibernateUtil.saveOrUpdate(job);

    ArrayList msg = new ArrayList();
    msg.add(job.getIdAsLong());
    msg.add(oldState);
    msg.add(reimport);

    try {
        JmsHelper.sendMessageToQueue(msg, JmsHelper.JMS_CANCEL_JOB_QUEUE);
    } catch (JMSException e) {
        job.setState(oldState);
        HibernateUtil.saveOrUpdate(job);
        s_logger.error(e.getMessage(), e);
    } catch (NamingException e) {
        s_logger.error(e.getMessage(), e);
    }
}