Skip to content

Commit

Permalink
Use 1 bulk request rather than a post per bundle when getting the sta…
Browse files Browse the repository at this point in the history
…rt level, makes a big difference for #650
  • Loading branch information
gashcrumb committed Nov 11, 2013
1 parent 3694818 commit 156fc03
Showing 1 changed file with 26 additions and 10 deletions.
36 changes: 26 additions & 10 deletions hawtio-web/src/main/webapp/app/osgi/js/bundle-list.ts
Expand Up @@ -148,21 +148,37 @@ module Osgi {

// Obtain start level information for all the bundles, let's do this async though
setTimeout(() => {

var requests = [];

for (var i = 0; i < $scope.bundles.length; i++) {
var b = $scope.bundles[i];
jolokia.request({
requests.push({
type: 'exec', mbean: getSelectionBundleMBean(workspace),
operation: 'getStartLevel(long)',
arguments: [$scope.bundles[i].Identifier]
}, onSuccess(function (bundle, last) {
return function (response) {
bundle.StartLevel = response.value;
if (last) {
Core.$apply($scope);
}
}
}(b, i === ($scope.bundles.length - 1))));
arguments: [b.Identifier]
});
}

var outstanding = requests.length;

jolokia.request(requests, onSuccess((response) => {
var id = response['request']['arguments'].first();
if (angular.isDefined(id)) {
var bundle = $scope.bundles[id];
if (bundle) {
log.debug("Setting bundle: ", bundle['Identifier'], " start level to: ", response['value']);
bundle['StartLevel'] = response['value'];
}
}
outstanding = outstanding - 1;
log.debug("oustanding responses: ", outstanding);
if (outstanding === 0) {
log.debug("Updating page...");
Core.$apply($scope);
}
}));

}, 500);
}
}
Expand Down

0 comments on commit 156fc03

Please sign in to comment.