
admin.components.threadpools.ThreadPoolDetails.js Maven / Gradle / Ivy
import React from "react";
import {inject, observer} from "mobx-react";
@observer
export default class ThreadPoolDetails extends React.Component {
threadPoolInfo(threadPool) {
const {poolName} = threadPool;
const {poolSize} = threadPool;
const {corePoolSize} = threadPool;
const {maximumPoolSize} = threadPool;
const {activeCount} = threadPool;
const {shutdown} = threadPool;
const {completedTaskCount} = threadPool;
const {largestPoolSize} = threadPool;
const {queueCapacity} = threadPool;
const {queuedTasks} = threadPool;
const label = shutdown ? 'label label-red' : 'label label-green';
const statusText = shutdown ? 'Shutdown' : 'Active';
const usagePercent = activeCount === 0 ? 0 : parseInt((activeCount / poolSize) * 100);
const poolSizePercent = poolSize === 0 ? 0 : parseInt((poolSize / maximumPoolSize) * 100);
const queuedTasksPercent = queuedTasks === 0 ? 0 : parseInt((queuedTasks / queueCapacity) * 100);
return (
{poolName}
{poolSize} / {maximumPoolSize}
{activeCount} / {poolSize}
{queuedTasks} / {queueCapacity}
{completedTaskCount}
{largestPoolSize}
{statusText}
)
}
render() {
let element = No thread pool available
if (this.props.threadPools && this.props.threadPools.length > 0) {
const threadPools = this.props.threadPools.map((tp) => {
return this.threadPoolInfo(tp);
});
element = (
Name
Pool size
Active taks
Queued tasks
Completed tasks
Largest pool size
Status
{threadPools}
)
}
return (
Thread pools
{element}
)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy