Skip to content

Instantly share code, notes, and snippets.

@dushmis
Created December 14, 2013 13:37
Show Gist options
  • Save dushmis/7959188 to your computer and use it in GitHub Desktop.
Save dushmis/7959188 to your computer and use it in GitHub Desktop.
java fixed thread pool executor
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
public class T {
private static final int NTHREAD = 100;
private static final Executor EXECUTOR = Executors.newFixedThreadPool(NTHREAD);
static int i;
public static void main(String[] args) {
while (true) {
Runnable task = new Runnable() {
@Override
public void run() {
System.out.println("..");
}
};
EXECUTOR.execute(task);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment