Tasks stop on unmanaged

stop tasks when entities are unmanaged, and better bookkeeping for scheduled tasks.
(also fixes eclipse IDE problems caused by checkstyle.)
Just to check... is the reason to use a map we synchronize on (rather than a `ConcurrentHashMap`) so that we can safely delete the entry when the set of tasks for that key is empty?