polishing

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3289 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller 2010-04-22 17:38:49 +00:00
parent 4e04cfae4a
commit 17101c0dfe
3 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ package org.springframework.jms.listener;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -209,7 +208,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
*/ */
public void shutdown() throws JmsException { public void shutdown() throws JmsException {
logger.debug("Shutting down JMS listener container"); logger.debug("Shutting down JMS listener container");
boolean wasRunning = false; boolean wasRunning;
synchronized (this.lifecycleMonitor) { synchronized (this.lifecycleMonitor) {
wasRunning = this.running; wasRunning = this.running;
this.running = false; this.running = false;
@ -549,6 +548,9 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
} }
} }
/**
* Determine the number of currently paused tasks, if any.
*/
public int getPausedTaskCount() { public int getPausedTaskCount() {
synchronized (this.lifecycleMonitor) { synchronized (this.lifecycleMonitor) {
return this.pausedTasks.size(); return this.pausedTasks.size();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2009 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -517,6 +517,7 @@ public abstract class AbstractMessageListenerContainer extends AbstractJmsListen
* @see SessionAwareMessageListener * @see SessionAwareMessageListener
* @see #setExposeListenerSession * @see #setExposeListenerSession
*/ */
@SuppressWarnings("unchecked")
protected void doInvokeListener(SessionAwareMessageListener listener, Session session, Message message) protected void doInvokeListener(SessionAwareMessageListener listener, Session session, Message message)
throws JMSException { throws JMSException {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2010 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -236,7 +236,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
if (this.transactionManager != null) { if (this.transactionManager != null) {
// Execute receive within transaction. // Execute receive within transaction.
TransactionStatus status = this.transactionManager.getTransaction(this.transactionDefinition); TransactionStatus status = this.transactionManager.getTransaction(this.transactionDefinition);
boolean messageReceived = true; boolean messageReceived;
try { try {
messageReceived = doReceiveAndExecute(invoker, session, consumer, status); messageReceived = doReceiveAndExecute(invoker, session, consumer, status);
} }
@ -288,7 +288,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe
transactional = (sessionToUse != null); transactional = (sessionToUse != null);
} }
if (sessionToUse == null) { if (sessionToUse == null) {
Connection conToUse = null; Connection conToUse;
if (sharedConnectionEnabled()) { if (sharedConnectionEnabled()) {
conToUse = getSharedConnection(); conToUse = getSharedConnection();
} }