Advertisement
Davencode

AppExecutors

Mar 5th, 2021
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. package com.example.movieapp;
  2.  
  3. import java.util.concurrent.Executor;
  4. import java.util.concurrent.Executors;
  5. import java.util.concurrent.ScheduledExecutorService;
  6.  
  7. public class AppExecutors {
  8. //Singleton Pattern
  9. private static AppExecutors instance;
  10.  
  11. public static AppExecutors getInstance(){
  12. if(instance == null){
  13. instance = new AppExecutors();
  14. }
  15. return instance;
  16. }
  17.  
  18. private final ScheduledExecutorService mNetworkIO = Executors.newScheduledThreadPool(3);
  19.  
  20. public ScheduledExecutorService netWorkIO(){
  21. return mNetworkIO;
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement