Stop storing one DAOManager per thread?
DAOManager.getDAOManager() in a given thread always returns the same
DAOManager instance (~ "per-thread singleton"). This was useful when we weren't using dependency injection everywhere, we could just call
getDAOManager() from anywhere and be happy.
Now that we use dependency injection,
DAOManager.getDAOManager() could always return a new instance; we would acquire it at the beginning of an operation (e.g., when calling
FrontController.doRequest), and we would inject it everywhere, so that there shouldn't be more than one
DAOManager used in a given thread (and so, no more than one connection to the database), if it is what we want.
Issue #58 describes a similar problem with
Also, should we keep storing
DAOManagers associated to a given thread in a synchronized Map? This is notably used to allow to kill a connection from another thread (to interrupt a long-running query). But this feature of storing
DAOManagers to be potentially interrupted could be implemented by another class, e.g.,
But, it also allows to close all
DAOManagers when calling
DAOManager.closeAll() (useful, e.g, for a servlet shutdown listener). So, maybe we should keep storing all opened