Use constructor injection for controllers.

Also made some listeners volatile.
This commit is contained in:
akwizgran
2016-10-11 12:31:21 +01:00
parent 0b3ec9aa4c
commit 2b91631ba5
12 changed files with 141 additions and 102 deletions

View File

@@ -13,16 +13,14 @@ public class DbControllerImpl implements DbController {
private static final Logger LOG =
Logger.getLogger(DbControllerImpl.class.getName());
// Fields that are accessed from background threads must be volatile
@Inject
@DatabaseExecutor
protected volatile Executor dbExecutor;
@Inject
protected volatile LifecycleManager lifecycleManager;
private final Executor dbExecutor;
private final LifecycleManager lifecycleManager;
@Inject
public DbControllerImpl() {
public DbControllerImpl(@DatabaseExecutor Executor dbExecutor,
LifecycleManager lifecycleManager) {
this.dbExecutor = dbExecutor;
this.lifecycleManager = lifecycleManager;
}
@Override