I am new to IntelliJ and Java in general. I am trying to learn multithreading and I came across a performer class.
So, I wanted to check this out, here is a sample of my code.
import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class LegController { private List<Runnable> legs; private ExecutorService execute; public LegController() { legs = new ArrayList<>(); for (int i = 0; i < 6; i++) { legs.add(LegFactory.getLeg("LEFT")); } execute = new Executors.newFixedThreadPool(6); } public void start(){
But I get an error: “Cannot resolve the symbol“ newFixedThreadPool. ”I tried“ Invalidate cache and restart ”, but that didn’t help, I tried to synchronize and rebuild the project, but it didn’t work either.
I don’t understand where this problem comes from, because the Executors class is imported. In addition, there was autocompletion of static methods of performers. Maybe the problem is in the import, but if so, how can I fix it?
source share