Skip to content
This repository has been archived by the owner on Sep 6, 2024. It is now read-only.

add method to get remaining ThreadPoolTaskExecutor's queue capacity #20

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,19 @@ public void shutdown() {
messageProcessingExecutor.getThreadPoolExecutor().awaitTermination(10, TimeUnit.SECONDS);
}
}
/**
* Returns the number of elements that the {@link #messageProcessingExecutor} can accept
* <p>
* This method should only be used in a single threaded environment, since it is possible that
* in a multi-threaded environment the number of free slots changes between the call to this method
*
* @return Remaining queue capacity
*/
public int getRemainingCapacity() {
return messageProcessingExecutor
.getThreadPoolExecutor()
.getQueue()
.remainingCapacity();
}

}
Loading