0
I’m trying to use an executor to record data in the database using threads. When instantiating an object from the Executor Service class and retrieving an instance from Executors.newSingleThreadExecutor(); returns the error that is not finding the newSingleThreadExecutor instance/declaration.
   ExecutorService exec = new Executors.newSingleThreadExecutor();
                       exec.execute(new Runnable() {
                            @Override
                            public void run() {
                                //Adicionando tarefa
                                addTask(itemList);
                            }
                        });
						
You added the respective import?
import java.util.concurrent.ExecutorService– ramaral
sim -> import java.util.Concurrent.Executorservice; import java.util.Concurrent.Executors; -> only newSingleThreadExecutor() is not recognizing
– Gabriel Ribeiro