Java Code Examples for org.springframework.jms.support.JmsUtils

The following examples show how to use org.springframework.jms.support.JmsUtils. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
/**
 * Execute the given remote invocation, sending an invoker request message
 * to this accessor's target queue and waiting for a corresponding response.
 * @param invocation the RemoteInvocation to execute
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 * @see #doExecuteRequest
 */
protected RemoteInvocationResult executeRequest(RemoteInvocation invocation) throws JMSException {
	Connection con = createConnection();
	Session session = null;
	try {
		session = createSession(con);
		Queue queueToUse = resolveQueue(session);
		Message requestMessage = createRequestMessage(session, invocation);
		con.start();
		Message responseMessage = doExecuteRequest(session, queueToUse, requestMessage);
		if (responseMessage != null) {
			return extractInvocationResult(responseMessage);
		}
		else {
			return onReceiveTimeout(invocation);
		}
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), true);
	}
}
 
Example 2
private void clearResources() {
	if (sharedConnectionEnabled()) {
		synchronized (sharedConnectionMonitor) {
			JmsUtils.closeMessageConsumer(this.consumer);
			JmsUtils.closeSession(this.session);
		}
	}
	else {
		JmsUtils.closeMessageConsumer(this.consumer);
		JmsUtils.closeSession(this.session);
	}
	if (this.consumer != null) {
		synchronized (lifecycleMonitor) {
			registeredWithDestination--;
		}
	}
	this.consumer = null;
	this.session = null;
}
 
Example 3
/**
 * Destroy the registered JMS Sessions and associated MessageConsumers.
 */
@Override
protected void doShutdown() throws JMSException {
	synchronized (this.consumersMonitor) {
		if (this.consumers != null) {
			logger.debug("Closing JMS MessageConsumers");
			for (MessageConsumer consumer : this.consumers) {
				JmsUtils.closeMessageConsumer(consumer);
			}
			if (this.sessions != null) {
				logger.debug("Closing JMS Sessions");
				for (Session session : this.sessions) {
					JmsUtils.closeSession(session);
				}
			}
		}
	}
}
 
Example 4
/**
 * Send the given response message to the given destination.
 * @param response the JMS message to send
 * @param destination the JMS destination to send to
 * @param session the JMS session to operate on
 * @throws JMSException if thrown by JMS API methods
 * @see #postProcessProducer
 * @see javax.jms.Session#createProducer
 * @see javax.jms.MessageProducer#send
 */
protected void sendResponse(Session session, Destination destination, Message response) throws JMSException {
	MessageProducer producer = session.createProducer(destination);
	try {
		postProcessProducer(producer, response);
		QosSettings settings = getResponseQosSettings();
		if (settings != null) {
			producer.send(response, settings.getDeliveryMode(), settings.getPriority(),
					settings.getTimeToLive());
		}
		else {
			producer.send(response);
		}
	}
	finally {
		JmsUtils.closeMessageProducer(producer);
	}
}
 
Example 5
Source Project: spring-analysis-note   Source File: JmsInvokerClientInterceptor.java    License: MIT License 6 votes vote down vote up
/**
 * Execute the given remote invocation, sending an invoker request message
 * to this accessor's target queue and waiting for a corresponding response.
 * @param invocation the RemoteInvocation to execute
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 * @see #doExecuteRequest
 */
protected RemoteInvocationResult executeRequest(RemoteInvocation invocation) throws JMSException {
	Connection con = createConnection();
	Session session = null;
	try {
		session = createSession(con);
		Queue queueToUse = resolveQueue(session);
		Message requestMessage = createRequestMessage(session, invocation);
		con.start();
		Message responseMessage = doExecuteRequest(session, queueToUse, requestMessage);
		if (responseMessage != null) {
			return extractInvocationResult(responseMessage);
		}
		else {
			return onReceiveTimeout(invocation);
		}
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), true);
	}
}
 
Example 6
Source Project: spring-analysis-note   Source File: JmsInvokerClientInterceptor.java    License: MIT License 6 votes vote down vote up
/**
 * Actually execute the given request, sending the invoker request message
 * to the specified target queue and waiting for a corresponding response.
 * <p>The default implementation is based on standard JMS send/receive,
 * using a {@link javax.jms.TemporaryQueue} for receiving the response.
 * @param session the JMS Session to use
 * @param queue the resolved target Queue to send to
 * @param requestMessage the JMS Message to send
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 */
@Nullable
protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
	TemporaryQueue responseQueue = null;
	MessageProducer producer = null;
	MessageConsumer consumer = null;
	try {
		responseQueue = session.createTemporaryQueue();
		producer = session.createProducer(queue);
		consumer = session.createConsumer(responseQueue);
		requestMessage.setJMSReplyTo(responseQueue);
		producer.send(requestMessage);
		long timeout = getReceiveTimeout();
		return (timeout > 0 ? consumer.receive(timeout) : consumer.receive());
	}
	finally {
		JmsUtils.closeMessageConsumer(consumer);
		JmsUtils.closeMessageProducer(producer);
		if (responseQueue != null) {
			responseQueue.delete();
		}
	}
}
 
Example 7
Source Project: spring-analysis-note   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
/**
 * Send the given JMS message.
 * @param session the JMS Session to operate on
 * @param destination the JMS Destination to send to
 * @param messageCreator callback to create a JMS Message
 * @throws JMSException if thrown by JMS API methods
 */
protected void doSend(Session session, Destination destination, MessageCreator messageCreator)
		throws JMSException {

	Assert.notNull(messageCreator, "MessageCreator must not be null");
	MessageProducer producer = createProducer(session, destination);
	try {
		Message message = messageCreator.createMessage(session);
		if (logger.isDebugEnabled()) {
			logger.debug("Sending created message: " + message);
		}
		doSend(producer, message);
		// Check commit - avoid commit call within a JTA transaction.
		if (session.getTransacted() && isSessionLocallyTransacted(session)) {
			// Transacted session created by this template -> commit.
			JmsUtils.commitIfNecessary(session);
		}
	}
	finally {
		JmsUtils.closeMessageProducer(producer);
	}
}
 
Example 8
Source Project: spring-analysis-note   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
/**
 * A variant of {@link #execute(SessionCallback, boolean)} that explicitly
 * creates a non-transactional {@link Session}. The given {@link SessionCallback}
 * does not participate in an existing transaction.
 */
@Nullable
private <T> T executeLocal(SessionCallback<T> action, boolean startConnection) throws JmsException {
	Assert.notNull(action, "Callback object must not be null");
	Connection con = null;
	Session session = null;
	try {
		con = createConnection();
		session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
		if (startConnection) {
			con.start();
		}
		if (logger.isDebugEnabled()) {
			logger.debug("Executing callback on JMS Session: " + session);
		}
		return action.doInJms(session);
	}
	catch (JMSException ex) {
		throw convertJmsAccessException(ex);
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), startConnection);
	}
}
 
Example 9
Source Project: spring-analysis-note   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
@Override
@Nullable
public <T> T browseSelected(final Queue queue, @Nullable final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(session -> {
		QueueBrowser browser = createBrowser(session, queue, messageSelector);
		try {
			return action.doInJms(session, browser);
		}
		finally {
			JmsUtils.closeQueueBrowser(browser);
		}
	}, true);
}
 
Example 10
Source Project: spring-analysis-note   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
@Override
@Nullable
public <T> T browseSelected(final String queueName, @Nullable final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(session -> {
		Queue queue = (Queue) getDestinationResolver().resolveDestinationName(session, queueName, false);
		QueueBrowser browser = createBrowser(session, queue, messageSelector);
		try {
			return action.doInJms(session, browser);
		}
		finally {
			JmsUtils.closeQueueBrowser(browser);
		}
	}, true);
}
 
Example 11
private void clearResources() {
	if (sharedConnectionEnabled()) {
		synchronized (sharedConnectionMonitor) {
			JmsUtils.closeMessageConsumer(this.consumer);
			JmsUtils.closeSession(this.session);
		}
	}
	else {
		JmsUtils.closeMessageConsumer(this.consumer);
		JmsUtils.closeSession(this.session);
	}
	if (this.consumer != null) {
		synchronized (lifecycleMonitor) {
			registeredWithDestination--;
		}
	}
	this.consumer = null;
	this.session = null;
}
 
Example 12
/**
 * Destroy the registered JMS Sessions and associated MessageConsumers.
 */
@Override
protected void doShutdown() throws JMSException {
	synchronized (this.consumersMonitor) {
		if (this.consumers != null) {
			logger.debug("Closing JMS MessageConsumers");
			for (MessageConsumer consumer : this.consumers) {
				JmsUtils.closeMessageConsumer(consumer);
			}
			if (this.sessions != null) {
				logger.debug("Closing JMS Sessions");
				for (Session session : this.sessions) {
					JmsUtils.closeSession(session);
				}
			}
		}
	}
}
 
Example 13
/**
 * Send the given response message to the given destination.
 * @param response the JMS message to send
 * @param destination the JMS destination to send to
 * @param session the JMS session to operate on
 * @throws JMSException if thrown by JMS API methods
 * @see #postProcessProducer
 * @see javax.jms.Session#createProducer
 * @see javax.jms.MessageProducer#send
 */
protected void sendResponse(Session session, Destination destination, Message response) throws JMSException {
	MessageProducer producer = session.createProducer(destination);
	try {
		postProcessProducer(producer, response);
		QosSettings settings = getResponseQosSettings();
		if (settings != null) {
			producer.send(response, settings.getDeliveryMode(), settings.getPriority(),
					settings.getTimeToLive());
		}
		else {
			producer.send(response);
		}
	}
	finally {
		JmsUtils.closeMessageProducer(producer);
	}
}
 
Example 14
/**
 * Actually execute the given request, sending the invoker request message
 * to the specified target queue and waiting for a corresponding response.
 * <p>The default implementation is based on standard JMS send/receive,
 * using a {@link javax.jms.TemporaryQueue} for receiving the response.
 * @param session the JMS Session to use
 * @param queue the resolved target Queue to send to
 * @param requestMessage the JMS Message to send
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 */
@Nullable
protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
	TemporaryQueue responseQueue = null;
	MessageProducer producer = null;
	MessageConsumer consumer = null;
	try {
		responseQueue = session.createTemporaryQueue();
		producer = session.createProducer(queue);
		consumer = session.createConsumer(responseQueue);
		requestMessage.setJMSReplyTo(responseQueue);
		producer.send(requestMessage);
		long timeout = getReceiveTimeout();
		return (timeout > 0 ? consumer.receive(timeout) : consumer.receive());
	}
	finally {
		JmsUtils.closeMessageConsumer(consumer);
		JmsUtils.closeMessageProducer(producer);
		if (responseQueue != null) {
			responseQueue.delete();
		}
	}
}
 
Example 15
Source Project: java-technology-stack   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
/**
 * Send the given JMS message.
 * @param session the JMS Session to operate on
 * @param destination the JMS Destination to send to
 * @param messageCreator callback to create a JMS Message
 * @throws JMSException if thrown by JMS API methods
 */
protected void doSend(Session session, Destination destination, MessageCreator messageCreator)
		throws JMSException {

	Assert.notNull(messageCreator, "MessageCreator must not be null");
	MessageProducer producer = createProducer(session, destination);
	try {
		Message message = messageCreator.createMessage(session);
		if (logger.isDebugEnabled()) {
			logger.debug("Sending created message: " + message);
		}
		doSend(producer, message);
		// Check commit - avoid commit call within a JTA transaction.
		if (session.getTransacted() && isSessionLocallyTransacted(session)) {
			// Transacted session created by this template -> commit.
			JmsUtils.commitIfNecessary(session);
		}
	}
	finally {
		JmsUtils.closeMessageProducer(producer);
	}
}
 
Example 16
Source Project: java-technology-stack   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
/**
 * A variant of {@link #execute(SessionCallback, boolean)} that explicitly
 * creates a non-transactional {@link Session}. The given {@link SessionCallback}
 * does not participate in an existing transaction.
 */
@Nullable
private <T> T executeLocal(SessionCallback<T> action, boolean startConnection) throws JmsException {
	Assert.notNull(action, "Callback object must not be null");
	Connection con = null;
	Session session = null;
	try {
		con = createConnection();
		session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
		if (startConnection) {
			con.start();
		}
		if (logger.isDebugEnabled()) {
			logger.debug("Executing callback on JMS Session: " + session);
		}
		return action.doInJms(session);
	}
	catch (JMSException ex) {
		throw convertJmsAccessException(ex);
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), startConnection);
	}
}
 
Example 17
Source Project: java-technology-stack   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
@Override
@Nullable
public <T> T browseSelected(final Queue queue, @Nullable final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(session -> {
		QueueBrowser browser = createBrowser(session, queue, messageSelector);
		try {
			return action.doInJms(session, browser);
		}
		finally {
			JmsUtils.closeQueueBrowser(browser);
		}
	}, true);
}
 
Example 18
Source Project: java-technology-stack   Source File: JmsTemplate.java    License: MIT License 6 votes vote down vote up
@Override
@Nullable
public <T> T browseSelected(final String queueName, @Nullable final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(session -> {
		Queue queue = (Queue) getDestinationResolver().resolveDestinationName(session, queueName, false);
		QueueBrowser browser = createBrowser(session, queue, messageSelector);
		try {
			return action.doInJms(session, browser);
		}
		finally {
			JmsUtils.closeQueueBrowser(browser);
		}
	}, true);
}
 
Example 19
private void clearResources() {
	if (sharedConnectionEnabled()) {
		synchronized (sharedConnectionMonitor) {
			JmsUtils.closeMessageConsumer(this.consumer);
			JmsUtils.closeSession(this.session);
		}
	}
	else {
		JmsUtils.closeMessageConsumer(this.consumer);
		JmsUtils.closeSession(this.session);
	}
	if (this.consumer != null) {
		synchronized (lifecycleMonitor) {
			registeredWithDestination--;
		}
	}
	this.consumer = null;
	this.session = null;
}
 
Example 20
/**
 * Destroy the registered JMS Sessions and associated MessageConsumers.
 */
@Override
protected void doShutdown() throws JMSException {
	synchronized (this.consumersMonitor) {
		if (this.consumers != null) {
			logger.debug("Closing JMS MessageConsumers");
			for (MessageConsumer consumer : this.consumers) {
				JmsUtils.closeMessageConsumer(consumer);
			}
			logger.debug("Closing JMS Sessions");
			for (Session session : this.sessions) {
				JmsUtils.closeSession(session);
			}
		}
	}
}
 
Example 21
/**
 * Execute the given remote invocation, sending an invoker request message
 * to this accessor's target queue and waiting for a corresponding response.
 * @param invocation the RemoteInvocation to execute
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 * @see #doExecuteRequest
 */
protected RemoteInvocationResult executeRequest(RemoteInvocation invocation) throws JMSException {
	Connection con = createConnection();
	Session session = null;
	try {
		session = createSession(con);
		Queue queueToUse = resolveQueue(session);
		Message requestMessage = createRequestMessage(session, invocation);
		con.start();
		Message responseMessage = doExecuteRequest(session, queueToUse, requestMessage);
		if (responseMessage != null) {
			return extractInvocationResult(responseMessage);
		}
		else {
			return onReceiveTimeout(invocation);
		}
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), true);
	}
}
 
Example 22
/**
 * Actually execute the given request, sending the invoker request message
 * to the specified target queue and waiting for a corresponding response.
 * <p>The default implementation is based on standard JMS send/receive,
 * using a {@link javax.jms.TemporaryQueue} for receiving the response.
 * @param session the JMS Session to use
 * @param queue the resolved target Queue to send to
 * @param requestMessage the JMS Message to send
 * @return the RemoteInvocationResult object
 * @throws JMSException in case of JMS failure
 */
protected Message doExecuteRequest(Session session, Queue queue, Message requestMessage) throws JMSException {
	TemporaryQueue responseQueue = null;
	MessageProducer producer = null;
	MessageConsumer consumer = null;
	try {
		responseQueue = session.createTemporaryQueue();
		producer = session.createProducer(queue);
		consumer = session.createConsumer(responseQueue);
		requestMessage.setJMSReplyTo(responseQueue);
		producer.send(requestMessage);
		long timeout = getReceiveTimeout();
		return (timeout > 0 ? consumer.receive(timeout) : consumer.receive());
	}
	finally {
		JmsUtils.closeMessageConsumer(consumer);
		JmsUtils.closeMessageProducer(producer);
		if (responseQueue != null) {
			responseQueue.delete();
		}
	}
}
 
Example 23
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> T execute(final Destination destination, final ProducerCallback<T> action) throws JmsException {
	Assert.notNull(action, "Callback object must not be null");
	return execute(new SessionCallback<T>() {
		@Override
		public T doInJms(Session session) throws JMSException {
			MessageProducer producer = createProducer(session, destination);
			try {
				return action.doInJms(session, producer);
			}
			finally {
				JmsUtils.closeMessageProducer(producer);
			}
		}
	}, false);
}
 
Example 24
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> T execute(final String destinationName, final ProducerCallback<T> action) throws JmsException {
	Assert.notNull(action, "Callback object must not be null");
	return execute(new SessionCallback<T>() {
		@Override
		public T doInJms(Session session) throws JMSException {
			Destination destination = resolveDestinationName(session, destinationName);
			MessageProducer producer = createProducer(session, destination);
			try {
				return action.doInJms(session, producer);
			}
			finally {
				JmsUtils.closeMessageProducer(producer);
			}
		}
	}, false);
}
 
Example 25
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Send the given JMS message.
 * @param session the JMS Session to operate on
 * @param destination the JMS Destination to send to
 * @param messageCreator callback to create a JMS Message
 * @throws JMSException if thrown by JMS API methods
 */
protected void doSend(Session session, Destination destination, MessageCreator messageCreator)
		throws JMSException {

	Assert.notNull(messageCreator, "MessageCreator must not be null");
	MessageProducer producer = createProducer(session, destination);
	try {
		Message message = messageCreator.createMessage(session);
		if (logger.isDebugEnabled()) {
			logger.debug("Sending created message: " + message);
		}
		doSend(producer, message);
		// Check commit - avoid commit call within a JTA transaction.
		if (session.getTransacted() && isSessionLocallyTransacted(session)) {
			// Transacted session created by this template -> commit.
			JmsUtils.commitIfNecessary(session);
		}
	}
	finally {
		JmsUtils.closeMessageProducer(producer);
	}
}
 
Example 26
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * A variant of {@link #execute(SessionCallback, boolean)} that explicitly
 * creates a non-transactional {@link Session}. The given {@link SessionCallback}
 * does not participate in an existing transaction.
 */
private <T> T executeLocal(SessionCallback<T> action, boolean startConnection) throws JmsException {
	Assert.notNull(action, "Callback object must not be null");
	Connection con = null;
	Session session = null;
	try {
		con = getConnectionFactory().createConnection();
		session = con.createSession(false, Session.AUTO_ACKNOWLEDGE);
		if (startConnection) {
			con.start();
		}
		if (logger.isDebugEnabled()) {
			logger.debug("Executing callback on JMS Session: " + session);
		}
		return action.doInJms(session);
	}
	catch (JMSException ex) {
		throw convertJmsAccessException(ex);
	}
	finally {
		JmsUtils.closeSession(session);
		ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory(), startConnection);
	}
}
 
Example 27
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> T browseSelected(final Queue queue, final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(new SessionCallback<T>() {
		@Override
		public T doInJms(Session session) throws JMSException {
			QueueBrowser browser = createBrowser(session, queue, messageSelector);
			try {
				return action.doInJms(session, browser);
			}
			finally {
				JmsUtils.closeQueueBrowser(browser);
			}
		}
	}, true);
}
 
Example 28
Source Project: spring4-understanding   Source File: JmsTemplate.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public <T> T browseSelected(final String queueName, final String messageSelector, final BrowserCallback<T> action)
		throws JmsException {

	Assert.notNull(action, "Callback object must not be null");
	return execute(new SessionCallback<T>() {
		@Override
		public T doInJms(Session session) throws JMSException {
			Queue queue = (Queue) getDestinationResolver().resolveDestinationName(session, queueName, false);
			QueueBrowser browser = createBrowser(session, queue, messageSelector);
			try {
				return action.doInJms(session, browser);
			}
			finally {
				JmsUtils.closeQueueBrowser(browser);
			}
		}
	}, true);
}
 
Example 29
/**
 * Create a shared Connection for this container.
 * <p>The default implementation creates a standard Connection
 * and prepares it through {@link #prepareSharedConnection}.
 * @return the prepared Connection
 * @throws JMSException if the creation failed
 */
protected Connection createSharedConnection() throws JMSException {
	Connection con = createConnection();
	try {
		prepareSharedConnection(con);
		return con;
	}
	catch (JMSException ex) {
		JmsUtils.closeConnection(con);
		throw ex;
	}
}
 
Example 30
/**
 * Handle the given exception that arose during setup of a listener.
 * Called for every such exception in every concurrent listener.
 * <p>The default implementation logs the exception at warn level
 * if not recovered yet, and at debug level if already recovered.
 * Can be overridden in subclasses.
 * @param ex the exception to handle
 * @param alreadyRecovered whether a previously executing listener
 * already recovered from the present listener setup failure
 * (this usually indicates a follow-up failure than can be ignored
 * other than for debug log purposes)
 * @see #recoverAfterListenerSetupFailure()
 */
protected void handleListenerSetupFailure(Throwable ex, boolean alreadyRecovered) {
	if (ex instanceof JMSException) {
		invokeExceptionListener((JMSException) ex);
	}
	if (ex instanceof SharedConnectionNotInitializedException) {
		if (!alreadyRecovered) {
			logger.debug("JMS message listener invoker needs to establish shared Connection");
		}
	}
	else {
		// Recovery during active operation..
		if (alreadyRecovered) {
			logger.debug("Setup of JMS message listener invoker failed - already recovered by other invoker", ex);
		}
		else {
			StringBuilder msg = new StringBuilder();
			msg.append("Setup of JMS message listener invoker failed for destination '");
			msg.append(getDestinationDescription()).append("' - trying to recover. Cause: ");
			msg.append(ex instanceof JMSException ? JmsUtils.buildExceptionMessage((JMSException) ex) : ex.getMessage());
			if (logger.isDebugEnabled()) {
				logger.warn(msg, ex);
			}
			else {
				logger.warn(msg);
			}
		}
	}
}