当前位置: 首页>>代码示例>>Java>>正文


Java JMSException.setLinkedException方法代码示例

本文整理汇总了Java中javax.jms.JMSException.setLinkedException方法的典型用法代码示例。如果您正苦于以下问题:Java JMSException.setLinkedException方法的具体用法?Java JMSException.setLinkedException怎么用?Java JMSException.setLinkedException使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.jms.JMSException的用法示例。


在下文中一共展示了JMSException.setLinkedException方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

import javax.jms.JMSException; //导入方法依赖的package包/类
/**
 * Creates or passes through a JMSException to be thrown to the client.
 *
 * In the event that the exception passed to this method is already a
 * JMSException it is passed through unmodified, otherwise a new JMSException
 * is created with the given message and the cause is set to the given
 * cause Throwable instance.
 *
 * @param message
 *        The message value to set when a new JMSException is created.
 * @param cause
 *        The exception that caused this error state.
 *
 * @return a JMSException instance.
 */
public static JMSException create(String message, Throwable cause) {
    if (cause instanceof JMSException) {
        return (JMSException) cause;
    }

    if (cause.getCause() instanceof JMSException) {
        return (JMSException) cause.getCause();
    }

    if (message == null || message.isEmpty()) {
        message = cause.getMessage();
        if (message == null || message.isEmpty()) {
            message = cause.toString();
        }
    }

    JMSException exception = new JMSException(message);
    if (cause instanceof Exception) {
        exception.setLinkedException((Exception) cause);
    }
    exception.initCause(cause);
    return exception;
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:39,代码来源:JMSExceptionSupport.java

示例2: setJMSCorrelationID

import javax.jms.JMSException; //导入方法依赖的package包/类
@Override
public void setJMSCorrelationID(String correlationID) throws JMSException {
    try {
        correlationId = correlationID.getBytes("iso-8859-1");
    } catch (UnsupportedEncodingException e) {
        final JMSException jmsException = new JMSException("Failed to get bytes from correlationID string");
        jmsException.setLinkedException(e);
        throw jmsException;
    }
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:11,代码来源:AbstractMessageImpl.java

示例3: getJMSCorrelationID

import javax.jms.JMSException; //导入方法依赖的package包/类
@Override
public String getJMSCorrelationID() throws JMSException {
    try {
        return new String(correlationId, "iso-8859-1");
    } catch (UnsupportedEncodingException e) {
        final JMSException jmsException = new JMSException("Failed to get string from correlationID bytes");
        jmsException.setLinkedException(e);
        throw jmsException;
    }
}
 
开发者ID:dajudge,项目名称:testee.fi,代码行数:11,代码来源:AbstractMessageImpl.java

示例4: receive

import javax.jms.JMSException; //导入方法依赖的package包/类
public Message receive(long timeout) throws JMSException {
    try {
        Thread.sleep(timeout);
    } catch (InterruptedException ex) {
        logger.warn(ex.getMessage(), ex);

        JMSException jmsException = new JMSException(ex.getMessage());
        jmsException.setLinkedException(ex);
        throw jmsException;
    }

    return getMessage();
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:14,代码来源:ProxyMessageConsumer.java


注:本文中的javax.jms.JMSException.setLinkedException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。