File tree 1 file changed +18
-1
lines changed
spring-jms/src/main/java/org/springframework/jms/connection
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2020 the original author or authors.
2
+ * Copyright 2002-2021 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -179,6 +179,23 @@ public boolean isCacheConsumers() {
179
179
}
180
180
181
181
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
+
182
199
/**
183
200
* Resets the Session cache as well.
184
201
*/
You can’t perform that action at this time.
0 commit comments