Home Features Docs Blog Support GitHub

Executors.newSingleThreadExecutor() in MOE


(Leejjon) #1

Hi,

I am playing around with ExecutorService implementations in the java.util.concurrency packages.

I tried to find out how to use them correctly within Android. Found this useful stackoverflow post and there is some stuff you have to do to ensure it works well on Android:

So do I have to worry about shutting down a service like below on MOE when my app is in the background?
private static final ExecutorService EXECUTOR_SERVICE = Executors.newSingleThreadExecutor();

I suppose when the app is killed iOS also kills the entire JVM instance so I don’t have to worry too much about shutting it down on completion, but I guess I can call EXECUTOR_SERVICE.shutdown() from libgdx’s dispose() method.