Start scheduling query management thread in a separate method
To prevent unsafe publication.
@@ -48,6 +48,7 @@ import org.weakref.jmx.Flatten;
import org.weakref.jmx.Managed;
import org.weakref.jmx.Nested;
+import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.concurrent.ThreadSafe;
import javax.inject.Inject;
@@ -191,6 +192,11 @@ public class SqlQueryManager
queryManagementExecutor = Executors.newScheduledThreadPool(queryManagerConfig.getQueryManagerExecutorPoolSize(), threadsNamed("query-management-%s"));
queryManagementExecutorMBean = new ThreadPoolExecutorMBean((ThreadPoolExecutor) queryManagementExecutor);
+ }
+
+ @PostConstruct
+ public void start()
+ {
queryManagementExecutor.scheduleWithFixedDelay(new Runnable()
{
@Override
