Guest User

Untitled

a guest
Nov 24th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. cat /proc/sys/kernel/threads-max
  2.  
  3. package com.stackoverflow.test;
  4.  
  5. import java.util.concurrent.ExecutorService;
  6. import java.util.concurrent.Executors;
  7.  
  8. public class TestMaxAmountOfThreads {
  9. public static void main(String[] args) {
  10. ExecutorService serivce = Executors.newFixedThreadPool(Integer.MAX_VALUE);
  11. for (int i = 0; i < Integer.MAX_VALUE; i++) {
  12. serivce.submit(new Runnable() {
  13. public void run() {
  14. try {
  15. Thread.sleep(Integer.MAX_VALUE);
  16. } catch (InterruptedException e) {
  17. }
  18. }
  19. });
  20. System.out.println(i);
  21. }
  22. }
  23. }
  24.  
  25. public ThreadPoolExecutor(int corePoolSize,**int maximumPoolSize**,long keepAliveTime,TimeUnit unit,BlockingQueue<Runnable> workQueue,ThreadFactory threadFactory,RejectedExecutionHandler handler)
Add Comment
Please, Sign In to add comment