Skip to content

Commit

Permalink
#852: Added thread pool subtab to jetty plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
davsclaus committed Dec 15, 2013
1 parent 9fdd050 commit ed8d5fd
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/app/jetty/html/jettyTabs.html
Expand Up @@ -8,6 +8,9 @@
<li ng-class='{active : isActive("#/jetty/connectors")}'>
<a ng-href="{{link('#/jetty/connectors')}}">Connectors</a>
</li>
<li ng-class='{active : isActive("#/jetty/threadpools")}'>
<a ng-href="{{link('#/jetty/threadpools')}}">Thread Pools</a>
</li>
<li ng-class='{active : isTopTabActive("jettyTree")}'>
<a ng-href="#/jmx/attributes?tab=jettyTree{{hash}}">JMX</a>
</li>
Expand Down
8 changes: 8 additions & 0 deletions hawtio-web/src/main/webapp/app/jetty/html/threadpools.html
@@ -0,0 +1,8 @@
<div class="row-fluid" ng-controller="Jetty.ThreadPoolsController">

<div class="row-fluid">
<div class="gridStyle" ng-grid="gridOptions"></div>
</div>

</div>

1 change: 1 addition & 0 deletions hawtio-web/src/main/webapp/app/jetty/js/jettyPlugin.ts
Expand Up @@ -10,6 +10,7 @@ module Jetty {
when('/jetty/server', {templateUrl: 'app/jetty/html/server.html'}).
when('/jetty/applications', {templateUrl: 'app/jetty/html/applications.html'}).
when('/jetty/connectors', {templateUrl: 'app/jetty/html/connectors.html'}).
when('/jetty/threadpools', {templateUrl: 'app/jetty/html/threadpools.html'}).
when('/jetty/mbeans', {templateUrl: 'app/jetty/html/mbeans.html'});
}).
filter('jettyIconClass',() => iconClass).
Expand Down
109 changes: 109 additions & 0 deletions hawtio-web/src/main/webapp/app/jetty/js/threadpools.ts
@@ -0,0 +1,109 @@
/**
* @module Jetty
*/
module Jetty {

export function ThreadPoolsController($scope, $location, workspace:Workspace, jolokia) {

var stateTemplate = '<div class="ngCellText pagination-centered" title="{{row.getProperty(col.field)}}"><i class="{{row.getProperty(col.field) | jettyIconClass}}"></i></div>';

$scope.threadpools = [];

var columnDefs:any[] = [
{
field: 'running',
displayName: 'State',
cellTemplate: stateTemplate,
width: 56,
minWidth: 56,
maxWidth: 56,
resizable: false
},
{
field: 'threads',
displayName: 'Threads',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'minThreads',
displayName: 'Min Threads',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'maxThreads',
displayName: 'Max Threads',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'idleThreads',
displayName: 'Idle Threads',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'maxIdleTimeMs',
displayName: 'Max Idle Time (ms)',
cellFilter: null,
width: "*",
resizable: true
},
{
field: 'name',
displayName: 'Name',
cellFilter: null,
width: "*",
resizable: true
}
];

$scope.gridOptions = {
data: 'threadpools',
displayFooter: true,
canSelectRows: false,
columnDefs: columnDefs,
title: "Thread Pools"
};

function render78(response) {
$scope.threadpools = [];

function onAttributes(response) {
var obj = response.value;
if (obj) {
$scope.threadpools.push(obj);
}
}

// create structure for each response
angular.forEach(response, function (value, key) {
var mbean = value;
jolokia.request({type: "read", mbean: mbean, attribute: []}, onSuccess(onAttributes));
});
Core.$apply($scope);
};

$scope.$on('jmxTreeUpdated', reloadFunction);
$scope.$watch('workspace.tree', reloadFunction);

function reloadFunction() {
// if the JMX tree is reloaded its probably because a new MBean has been added or removed
// so lets reload, asynchronously just in case
setTimeout(loadData, 50);
}

function loadData() {
console.log("Loading Jetty thread pool data...");
var tree = workspace.tree;

jolokia.search("org.eclipse.jetty.util.thread:type=queuedthreadpool,*", onSuccess(render78));
}

}
}

0 comments on commit ed8d5fd

Please sign in to comment.