From 17101c0dfe14d47fee7e35de876537ccc42acd0d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 22 Apr 2010 17:38:49 +0000 Subject: [PATCH] polishing git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3289 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../jms/listener/AbstractJmsListeningContainer.java | 8 +++++--- .../jms/listener/AbstractMessageListenerContainer.java | 3 ++- .../listener/AbstractPollingMessageListenerContainer.java | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java index 975798ace2f..0c205857f02 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractJmsListeningContainer.java @@ -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"); * 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.LinkedList; import java.util.List; - import javax.jms.Connection; import javax.jms.JMSException; @@ -209,7 +208,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess */ public void shutdown() throws JmsException { logger.debug("Shutting down JMS listener container"); - boolean wasRunning = false; + boolean wasRunning; synchronized (this.lifecycleMonitor) { wasRunning = this.running; 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() { synchronized (this.lifecycleMonitor) { return this.pausedTasks.size(); diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java index 00bde493bb6..551b9ce7b0d 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractMessageListenerContainer.java @@ -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"); * 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 #setExposeListenerSession */ + @SuppressWarnings("unchecked") protected void doInvokeListener(SessionAwareMessageListener listener, Session session, Message message) throws JMSException { diff --git a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java index 376d6a917b3..d209b771b14 100644 --- a/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java +++ b/org.springframework.jms/src/main/java/org/springframework/jms/listener/AbstractPollingMessageListenerContainer.java @@ -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"); * 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) { // Execute receive within transaction. TransactionStatus status = this.transactionManager.getTransaction(this.transactionDefinition); - boolean messageReceived = true; + boolean messageReceived; try { messageReceived = doReceiveAndExecute(invoker, session, consumer, status); } @@ -288,7 +288,7 @@ public abstract class AbstractPollingMessageListenerContainer extends AbstractMe transactional = (sessionToUse != null); } if (sessionToUse == null) { - Connection conToUse = null; + Connection conToUse; if (sharedConnectionEnabled()) { conToUse = getSharedConnection(); }