Created
December 14, 2013 13:37
-
-
Save dushmis/7959188 to your computer and use it in GitHub Desktop.
java fixed thread pool executor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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