Firebase database - run on different thread

I want to run the events of firebase on different thread. On the last version of firebase I had this code that did it

    Config firebaseConfig = new Config();
    firebaseConfig.setEventTarget(new EventTarget() {
        ExecutorService executor = Executors.newSingleThreadExecutor();
        @Override
        public void postEvent(Runnable runnable) {
            executor.execute(runnable);
        }

        @Override
        public void shutdown() {
            executor.shutdown();
        }

        @Override
        public void restart() {

        }
    });
    Firebase.setDefaultConfig(firebaseConfig);

How can I do it in the new api? Their is a way or I have to implement it by my self? (create runnable of every function and run it in the executor)


ANSWERS:


The Firebase Database client performs all networking, disk I/O and other maintenance on a separate thread. It then surfaces the callbacks to your code on the main thread, so that you can interact with the UI.

In most situations you don't have to do anything special and can just let the Firebase client deal with the cross-threading handling. Only when you need to do some heavy work in your callback (e.g. onDataChange()) will you have to run that work off the main thread again. You can use the usual Android threading mechanisms for that.



 MORE:


 ? Android Firebase Database Automatic Refresh UPDATE 2
 ? how to put Firebase RecyclerView inside another RecyclerView
 ? how to put Firebase RecyclerView inside another RecyclerView
 ? how to put Firebase RecyclerView inside another RecyclerView
 ? firebase recyclerview gives an untraceble error
 ? How to retrieve all the data from Firebase and put it on a RecyclerView
 ? Android Firebase, server side filtering for Recyclerview
 ? Android + Firebase, getValue from database and populate viewText field
 ? Android + Firebase, getValue from database and populate viewText field
 ? Android + Firebase, getValue from database and populate viewText field