From 4b32fa55eb2ef1eded7602bc58887229f864c50b Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Fri, 8 Aug 2014 10:25:51 +0900 Subject: [PATCH] Fix javadoc. --- .../main/java/com/zaxxer/hikari/util/ConcurrentBag.java | 8 +++++++- .../main/java/com/zaxxer/hikari/util/ConcurrentBag.java | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java b/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java index 427e3f89..3359998a 100644 --- a/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java +++ b/hikaricp-java6/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java @@ -277,10 +277,16 @@ public final class ConcurrentBag return synchronizer.getQueueLength(); } + /** + * Get a count of the number of items in the specified state at the time of this call. + * + * @param state the state of the items to count + * @return a count of how many items in the bag are in the specified state + */ public int getCount(final int state) { int count = 0; - for (T reference : sharedList) { + for (final T reference : sharedList) { if (reference.state.get() == state) { count++; } diff --git a/hikaricp/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java b/hikaricp/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java index 6acc3d79..06d23b18 100644 --- a/hikaricp/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java +++ b/hikaricp/src/main/java/com/zaxxer/hikari/util/ConcurrentBag.java @@ -102,7 +102,7 @@ public final class ConcurrentBag } /** - * Constuct a ConcurrentBag with the specified listener. + * Construct a ConcurrentBag with the specified listener. */ public ConcurrentBag(IBagStateListener listener) { @@ -274,6 +274,12 @@ public final class ConcurrentBag return synchronizer.getQueueLength(); } + /** + * Get a count of the number of items in the specified state at the time of this call. + * + * @param state the state of the items to count + * @return a count of how many items in the bag are in the specified state + */ public int getCount(final int state) { return (int) sharedList.stream().filter(reference -> reference.state.get() == state).count();