File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
spring-jms/src/main/java/org/springframework/jms/connection Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright 2002-2020 the original author or authors.
2+ * Copyright 2002-2021 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -179,6 +179,23 @@ public boolean isCacheConsumers() {
179179 }
180180
181181
182+ /**
183+ * Return a current session count, indicating the number of sessions currently
184+ * cached by this connection factory.
185+ * @since 5.3.7
186+ */
187+ public int getCachedSessionCount () {
188+ int count = 0 ;
189+ synchronized (this .cachedSessions ) {
190+ for (Deque <Session > sessionList : this .cachedSessions .values ()) {
191+ synchronized (sessionList ) {
192+ count += sessionList .size ();
193+ }
194+ }
195+ }
196+ return count ;
197+ }
198+
182199 /**
183200 * Resets the Session cache as well.
184201 */
You can’t perform that action at this time.
0 commit comments