`monitor` will only ever be called once, so this won't leak. However, it might be cleaner Java code to implement as it's own class, TimerTask, rather than make an anonymous class, for clarity. No need for a separate file or anything, within `class Monitor` is fine.