热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

探讨javax.jms.JMSException中getLocalizedMessage方法的应用与实例代码分析

本文整理了Java中javax.jms.JMSException.getLocalizedMessage()方法的一些代码示例,展示了JMSException.getLocalizedMessage(

本文整理了Java中javax.jms.JMSException.getLocalizedMessage()方法的一些代码示例,展示了JMSException.getLocalizedMessage()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMSException.getLocalizedMessage()方法的具体详情如下:
包路径:javax.jms.JMSException
类名称:JMSException
方法名:getLocalizedMessage

JMSException.getLocalizedMessage介绍

暂无

代码示例

代码示例来源:origin: org.apache.apex/malhar-library

/**
* cleanup connection resources.
*/
protected void cleanup()
{
try {
session.close();
connection.close();
session = null;
cOnnection= null;
} catch (JMSException ex) {
logger.debug(ex.getLocalizedMessage());
}
}

代码示例来源:origin: org.apache.apex/malhar-library

/**
* Implementation of {@link ExceptionListener}
*
* @param ex
*/
@Override
public void onException(JMSException ex)
{
cleanup();
LOG.error(ex.getLocalizedMessage());
throwable.set(ex);
throw new RuntimeException(ex);
}

代码示例来源:origin: org.apache.apex/malhar-library

public void closeConnection()
{
try {
consumer.close();
session.close();
connection.close();
} catch (JMSException ex) {
logger.debug(ex.getLocalizedMessage());
}
}
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public void accept(final String key, final Object value) {
try {
jmsMapMessage.setObject(key, value);
} catch (final JMSException e) {
throw new IllegalArgumentException(String.format("%s mapping key '%s' to value '%s': %s",
e.getClass(), key, value, e.getLocalizedMessage()), e);
}
}
});

代码示例来源:origin: org.apache.apex/malhar-library

@Override
public void onMessage(Message message)
{
// Stop listener if captured maximum messages.
if (countMessages++ >= maximumReceiveMessages && maximumReceiveMessages != 0) {
try {
logger.warn("Reached maximum receive messages of {}", maximumReceiveMessages);
consumer.setMessageListener(null);
} catch (JMSException ex) {
logger.debug(ex.getLocalizedMessage());
}
return;
}
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

private boolean closeConnection() {
if (cOnnection== null) {
return true;
}
final Connection temp = connection;
cOnnection= null;
try {
temp.close();
return true;
} catch (final JMSException e) {
StatusLogger.getLogger().debug(
"Caught exception closing JMS Connection: {} ({}); continuing JMS manager shutdown",
e.getLocalizedMessage(), temp, e);
return false;
}
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

private boolean closeMessageProducer() {
if (messageProducer == null) {
return true;
}
final MessageProducer temp = messageProducer;
messageProducer = null;
try {
temp.close();
return true;
} catch (final JMSException e) {
StatusLogger.getLogger().debug(
"Caught exception closing JMS MessageProducer: {} ({}); continuing JMS manager shutdown",
e.getLocalizedMessage(), temp, e);
return false;
}
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

private boolean closeSession() {
if (session == null) {
return true;
}
final Session temp = session;
session = null;
try {
temp.close();
return true;
} catch (final JMSException e) {
StatusLogger.getLogger().debug(
"Caught exception closing JMS Session: {} ({}); continuing JMS manager shutdown",
e.getLocalizedMessage(), temp, e);
return false;
}
}

代码示例来源:origin: org.apache.apex/malhar-library

/**
* If getJMSReplyTo is set then send message back to reply producer.
*
* @param message
*/
protected void sendReply(Message message)
{
try {
if (message.getJMSReplyTo() != null) { // Send reply only if the replyTo destination is set
replyProducer.send(message.getJMSReplyTo(),
getSession().createTextMessage("Reply: " + message.getJMSMessageID()));
}
} catch (JMSException ex) {
LOG.error(ex.getLocalizedMessage());
throwable.set(ex);
throw new RuntimeException(ex);
}
}

代码示例来源:origin: org.geoserver/jms-geoserver

@Override
public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("Incoming message event of type " + event.getClass().getSimpleName()
+ " from Catalog");
}
// skip incoming events until context is loaded
if (!isEnabled()) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("skipping incoming event: context is not initted");
}
return;
}
// update properties
Properties optiOns= getProperties();
try {
jmsPublisher.publish(getTopic(), getJmsTemplate(), options, event);
} catch (JMSException e) {
if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) {
LOGGER.severe(e.getLocalizedMessage());
}
throw new CatalogException(e);
}
}

代码示例来源:origin: org.ballerinalang/ballerina-jms

@Override
public void commit() {
try {
if (session.getAcknowledgeMode() == Session.SESSION_TRANSACTED) {
session.commit();
}
} catch (JMSException e) {
throw new BallerinaException("transaction commit failed: " + e.getLocalizedMessage(), e);
}
}

代码示例来源:origin: org.ballerinalang/ballerina-jms

@Override
public void rollback() {
try {
if (session.getAcknowledgeMode() == Session.SESSION_TRANSACTED) {
session.rollback();
}
} catch (JMSException e) {
throw new BallerinaException("transaction rollback failed: " + e.getLocalizedMessage(), e);
}
}

代码示例来源:origin: org.geoserver/gs-jms-geoserver

@Override
public void handleRemoveEvent(CatalogRemoveEvent event) throws CatalogException {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("Incoming message event of type " + event.getClass().getSimpleName()
+ " from Catalog");
}
// skip incoming events until context is loaded
if (!isEnabled()) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("skipping incoming event: context is not initted");
}
return;
}
// update properties
Properties optiOns= getProperties();
try {
jmsPublisher.publish(getTopic(), getJmsTemplate(), options, event);
} catch (JMSException e) {
if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) {
LOGGER.severe(e.getLocalizedMessage());
}
throw new CatalogException(e);
}
}

代码示例来源:origin: org.geoserver/jms-geoserver

@Override
public void handleGlobalChange(GeoServerInfo global, List propertyNames,
List oldValues, List newValues) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("Incoming event");
}
// skip incoming events if producer is not Enabled
if (!isEnabled()) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("skipping incoming event: context is not initted");
}
return;
}
try {
// update properties
final Properties optiOns= getProperties();
// propagate the event
jmsPublisher.publish(getTopic(), getJmsTemplate(), options,
new JMSGlobalModifyEvent(ModificationProxy.unwrap(global), propertyNames,
oldValues, newValues));
} catch (JMSException e) {
if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) {
LOGGER.severe(e.getLocalizedMessage());
}
}
}

代码示例来源:origin: org.geoserver/gs-jms-geoserver

@Override
public void handleGlobalChange(GeoServerInfo global, List propertyNames,
List oldValues, List newValues) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("Incoming event");
}
// skip incoming events if producer is not Enabled
if (!isEnabled()) {
if (LOGGER.isLoggable(java.util.logging.Level.FINE)) {
LOGGER.fine("skipping incoming event: context is not initted");
}
return;
}
try {
// update properties
final Properties optiOns= getProperties();
// propagate the event
jmsPublisher.publish(getTopic(), getJmsTemplate(), options,
new JMSGlobalModifyEvent(ModificationProxy.unwrap(global), propertyNames,
oldValues, newValues));
} catch (JMSException e) {
if (LOGGER.isLoggable(java.util.logging.Level.SEVERE)) {
LOGGER.severe(e.getLocalizedMessage());
}
}
}

代码示例来源:origin: wso2/wso2-synapse

/**
* Acknowledge the message
*
* @return true if ack is processed successfully. If there was some issue,
* we call recover on session will return false
*/
public boolean ack() {
try {
if (message != null) {
message.acknowledge();
}
} catch (javax.jms.IllegalStateException e) {
logger.warn("JMS Session is in an illegal state. Recovering session.");
try {
getSession().recover();
logger.warn("JMS Session recovered.");
} catch (JMSException e1) {
logger.error("Error occurred while recovering session: "
+ e.getLocalizedMessage(), e);
return false;
}
return false;
} catch (JMSException e) {
logger.error(getId() + " cannot ack last read message. Error:"
+ e.getLocalizedMessage(), e);
return false;
}
return true;
}

代码示例来源:origin: org.apache.apex/malhar-library

/**
* Create a JMS Message for the given tuple.
* @return Message
*/
@Override
protected Message createMessage(Object tuple)
{
try {
if (tuple instanceof Message) {
return (Message)tuple;
} else if (tuple instanceof String) {
return getSession().createTextMessage((String)tuple);
} else if (tuple instanceof byte[]) {
BytesMessage message = getSession().createBytesMessage();
message.writeBytes((byte[])tuple);
return message;
} else if (tuple instanceof Map) {
return createMessageForMap((Map)tuple);
} else if (tuple instanceof Serializable) {
return getSession().createObjectMessage((Serializable)tuple);
} else {
throw new RuntimeException("Cannot convert object of type "
+ tuple.getClass() + "] to JMS message. Supported message "
+ "payloads are: String, byte array, Map, Serializable object.");
}
} catch (JMSException ex) {
logger.error(ex.getLocalizedMessage());
throw new RuntimeException(ex);
}
}

代码示例来源:origin: org.apache.apex/malhar-library

createConnection();
} catch (JMSException ex) {
logger.debug(ex.getLocalizedMessage());
throw new RuntimeException(ex);

代码示例来源:origin: wso2/wso2-synapse

private void setTransportHeaders(Message message, MessageContext synCtx){
//Set transport headers to the message
Map headerMap = (Map) ((Axis2MessageContext)synCtx).getAxis2MessageContext().getProperty(org.apache.axis2.context.MessageContext.TRANSPORT_HEADERS);
if(headerMap != null) {
for (Object headerName : headerMap.keySet()) {
String name = (String) headerName;
Object value = headerMap.get(name);
try {
if (value instanceof String) {
message.setStringProperty(name, (String) value);
} else if (value instanceof Boolean) {
message.setBooleanProperty(name, (Boolean) value);
} else if (value instanceof Integer) {
message.setIntProperty(name, (Integer) value);
} else if (value instanceof Long) {
message.setLongProperty(name, (Long) value);
} else if (value instanceof Double) {
message.setDoubleProperty(name, (Double) value);
} else if (value instanceof Float) {
message.setFloatProperty(name, (Float) value);
}
} catch (JMSException ex) {
if (logger.isDebugEnabled()) {
logger.debug("Could not save Message property: " + ex.getLocalizedMessage());
}
}
}
}
}

代码示例来源:origin: wso2/wso2-synapse

logger.debug("Could not save Message property: " + e.getLocalizedMessage());

推荐阅读
author-avatar
安份丶小娚人
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有