- 浏览: 101501 次
- 性别:
- 来自: 北京
最新评论
文章列表
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 ...
- 2012-02-27 17:57
- 浏览 624
- 评论(0)
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 ...
- 2012-02-27 17:46
- 浏览 573
- 评论(0)
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 ...
- 2012-02-27 17:41
- 浏览 187
- 评论(0)
<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 ...
- 2012-02-27 10:40
- 浏览 520
- 评论(0)
Exchanger
- 博客分类:
- java concurrency
<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 ...
- 2012-02-27 09:30
- 浏览 297
- 评论(0)
个人感觉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 ...
- 2012-02-24 17:24
- 浏览 636
- 评论(0)
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 ...