I am working on project where there is a need to monitor connection pool usage like ActiveCount, AvailableCount, MaxUsedCount. I am struggling to find something useful. I know that connection pool craetes an MBean and binds it with the underlying available JMX server.This MBean will hold all the information about the connection pool. I want have access to this MBean so that I can access all attributes inside it.
However I know if I execute jboss-cli.sh in linux environment and execute
/subsystem=datasources/data-source=ExampleDS/statistics=pool:read-resource(include-runtime=true)
I will get below output
{
"outcome" => "success",
"result" => {
"ActiveCount" => "0",
"AvailableCount" => "20",
"AverageBlockingTime" => "0",
"AverageCreationTime" => "0",
"CreatedCount" => "0",
"DestroyedCount" => "0",
"MaxCreationTime" => "0",
"MaxUsedCount" => "0",
"MaxWaitTime" => "0",
"TimedOut" => "0",
"TotalBlockingTime" => "0",
"TotalCreationTime" => "0"
}
}
Now same thing I wanted to achieve using programmatically. I am not sure how do I do this. Because I will run some program which will run at specific time interval and log connection data like ActiveCount, AvailableCount, MaxUsedCount which can be used further.
NOTE: I am using wilfly-9.0.1.Final
Please Guide.