I'm developing an Android app, and I need a ThreadPool for background operation (insert/retrieve from database, calculating distances between latent points, etc) in repositories and in a foreground service. The official Android documentation says that it's correct to put ThreadPoolExecutor in a class that extends Application ( https://developer.android.com/guide/background/threading ) but they and other sources also says that's correct write a singleton class holding the ThreadPoolExecutor . I don't need to access context or other android framework related stuff in my ThreadPoolExecutor class, so now I'm confused: should I extend the application or do a singleton class? My doubt is that my foreground service is running even if app is killed, so it may be better use the separate singleton?
Thank in advance!