`
Cages
  • 浏览: 101501 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
  package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestCallerRunsPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecuto ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestAbortPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool = new ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestAbortPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool = n ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestRejectedPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool = n ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestRejectedPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestRejectedPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool ...
package com.jerry.concurrency; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; public class TestRejectedPolicy { public static void main(String[] args) throws InterruptedException { ThreadPoolExecutor pool = n ...
<pre name="code" class="java">package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Exchanger; import java.util.concurrent.Executors; public class TestExchanger { public static void main(Stri ...
package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Exchanger; import java.util.concurrent.Executors; public class TestExchanger { public static void main(String[] args) { ExecutorService thread =Executors.newCachedT ...

Exchanger

<pre name="code" class="java">package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Exchanger; import java.util.concurrent.Executors; public class TestExchanger { public static void main(Stri ...
个人感觉countdownlatch功能么有CyclicBarrier强大,demo如下: package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TestCountdownlatch { public static void main(S ...
个人感觉countdownlatch功能么有CyclicBarrier强大,demo如下: package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TestCountdownlatch { public static void main(String ...
个人感觉countdownlatch功能么有CyclicBarrier强大,demo如下: package com.jerry.concurrency; import java.util.Random; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class TestCountdownlatch {public static void main(String[] ...
BlockingQueue实现的生产者消费者模式:10个线程生产 1个线程消费 package com.jerry.concurrency; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; public class TestBlockingQueue { public static vo ...
BlockingQueue实现的生产者消费者模式:10个线程生产 1个线程消费   package com.jerry.concurrency; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; public class TestBlockingQueue {public st ...
Global site tag (gtag.js) - Google Analytics