ref 7642:Portlet accounting-manager-1-6-0 requires 50 percent of VM CPU since startup steadily

https://support.d4science.org/issues/7642

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/admin/accounting-manager@146268 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-03-22 14:54:59 +00:00
parent 3883f2e75d
commit 7e1f1bbcbd
1 changed files with 12 additions and 15 deletions

View File

@ -34,8 +34,6 @@ import org.slf4j.LoggerFactory;
*/
public class AccountingClientDaemon implements Runnable {
private static Logger logger = LoggerFactory
.getLogger(AccountingClientDaemon.class);
@ -54,12 +52,12 @@ public class AccountingClientDaemon implements Runnable {
tasks = new ArrayList<>();
initTimeout();
}
private void initTimeout(){
private void initTimeout() {
sce.getServletContext()
.setAttribute(
SessionConstants.ACCOUNTING_CLIENT_MONITOR_TIME_OUT_PERIODMILLIS,
Long.valueOf(timeout));
.setAttribute(
SessionConstants.ACCOUNTING_CLIENT_MONITOR_TIME_OUT_PERIODMILLIS,
Long.valueOf(timeout));
retrieveTimeOut();
startThreadPoolTimeoutUpdateTimer();
}
@ -81,8 +79,8 @@ public class AccountingClientDaemon implements Runnable {
ExecutorService executorService = Executors.newFixedThreadPool(20);
while (running) {
if (!jobQueue.isEmpty()) {
final TaskRequest taskRequest = jobQueue.poll();
while (!jobQueue.isEmpty()) {
TaskRequest taskRequest = jobQueue.poll();
AccountingClientCallable accountingClientCallable = new AccountingClientCallable(
taskRequest, accountingCache);
@ -128,12 +126,11 @@ public class AccountingClientDaemon implements Runnable {
}
tasks.removeAll(dones);
} else {
try {
Thread.sleep(Constants.DAEMON_SLEEP_MILLIS);
} catch (InterruptedException e) {
}
}
try {
Thread.sleep(Constants.DAEMON_SLEEP_MILLIS);
} catch (InterruptedException e) {
}
}