Minor update: Check for null first before using the object.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@453629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrian T. Co 2006-10-06 15:02:42 +00:00
parent f8485e3b36
commit ff7bee0e49
1 changed files with 4 additions and 4 deletions

View File

@ -581,12 +581,12 @@ public abstract class AbstractConnection implements Service, Connection, Task, C
ConnectionState cs = lookupConnectionState(connectionId);
SessionState session = cs.getSessionState(id);
// Don't let new consumers or producers get added while we are closing this down.
session.shutdown();
if( session == null )
throw new IllegalStateException("Cannot remove session that had not been registered: "+id);
// Don't let new consumers or producers get added while we are closing this down.
session.shutdown();
// Cascade the connection stop to the consumers and producers.
for (Iterator iter = session.getConsumerIds().iterator(); iter.hasNext();) {