# HG changeset patch # User Omair Majid # Date 1418749280 18000 # Node ID 5587452a4d91ccdd819c694353f1e332c8b41571 # Parent d8140bc6ddb5ba588248a6145994651b055c153f Reduce timer threads Reviewed-by: jerboaa Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2014-December/012265.html diff -r d8140bc6ddb5 -r 5587452a4d91 common/core/src/main/java/com/redhat/thermostat/common/internal/ApplicationServiceImpl.java --- a/common/core/src/main/java/com/redhat/thermostat/common/internal/ApplicationServiceImpl.java Mon Dec 15 13:23:01 2014 +0100 +++ b/common/core/src/main/java/com/redhat/thermostat/common/internal/ApplicationServiceImpl.java Tue Dec 16 12:01:20 2014 -0500 @@ -54,8 +54,13 @@ // when used carelessly). private ExecutorService executor = Executors.newCachedThreadPool(); - // TODO: this is hardcoded, should really go into the configuration file - private TimerFactory timers = new ThreadPoolTimerFactory(100); + private TimerFactory timers; + + public ApplicationServiceImpl() { + // TODO merge with QueuedStorage's determine-number-of-threads implementation + int poolSize = Runtime.getRuntime().availableProcessors() * 2; + timers = new ThreadPoolTimerFactory(poolSize); + } @Override public ApplicationCache getApplicationCache() {