码迷,mamicode.com
首页 > 其他好文 > 详细

生产都消费者模式的一个demo,消费者设置缓存

时间:2016-02-02 01:10:49      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:

package queue;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by MyWorld on 2016/2/1.
 */
public class App {
    public static LinkedBlockingQueue<String> queue = new LinkedBlockingQueue(2);
    public static ExecutorService executorService = new ThreadPoolExecutor(5, 10,
            60L, TimeUnit.SECONDS,
            new LinkedBlockingQueue<Runnable>());

    public static void main(String[] args) {
        App.executorService.execute(new Producer());
        while (true) {
            System.out.println(String.format("%s current size: %s", Thread.currentThread().toString(), queue.size()));
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }

}
package queue;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * Created by MyWorld on 2016/2/1.
 */
public class Producer implements Runnable {
    static {
        System.out.println(String.format("%s success to init", Thread.currentThread().toString()));
        App.executorService.execute(new ConsumerManager());
    }

    @Override
    public void run() {
        String[] chars = {"A", "B", "C", "D"};
        Random random = new Random();
        while (true) {
            String tag = chars[random.nextInt(3)];
            for (int i = 0; i < 100; i++) {
                String produceValue = tag + i;
                System.out.println(String.format("%s produce value: %s", Thread.currentThread().toString(), produceValue));
                App.queue.add(produceValue);
                try {
                    TimeUnit.SECONDS.sleep(1);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }

}
package queue;

import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.TimeUnit;

/**
 * Created by MyWorld on 2016/2/1.
 */
public class ConsumerManager implements Runnable {
    @Override
    public void run() {
        Set<String> cache = new HashSet<String>();
        while (true) {
            try {
                String value = App.queue.poll(5, TimeUnit.SECONDS);
                if (value == null) {
                    if (!cache.isEmpty()) {
                        cache = addToDo(cache);
                    }
                    value = App.queue.take();
                    System.out.println(String.format("%s take value: %s", Thread.currentThread().toString(), value));
                    cache.add(value);
                } else {
                    System.out.println(String.format("%s poll value: %s", Thread.currentThread().toString(), value));
                    cache.add(value);
                    if (cache.size() > 10) {
                        cache = addToDo(cache);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    private Set<String> addToDo(Set<String> cache) {
        App.executorService.execute(new Worker(cache));
        cache = new HashSet<String>();
        return cache;
    }

}
package queue;

import java.util.Set;

/**
 * Created by MyWorld on 2016/2/1.
 */
public class Worker implements Runnable {
    private Set<String> cache;

    public Worker(Set<String> cache) {
        this.cache = cache;
    }

    @Override
    public void run() {
        for (String value : cache) {
            System.out.println(String.format("%s worker consume value: %s", Thread.currentThread().toString(), value));
        }
    }
}

Output:

Thread[main,5,main] success to init
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C0
Thread[pool-1-thread-1,5,main] poll value: C0
Thread[pool-1-thread-2,5,main] produce value: C1
Thread[pool-1-thread-1,5,main] poll value: C1
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C2
Thread[pool-1-thread-1,5,main] poll value: C2
Thread[pool-1-thread-2,5,main] produce value: C3
Thread[pool-1-thread-1,5,main] poll value: C3
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C4
Thread[pool-1-thread-1,5,main] poll value: C4
Thread[pool-1-thread-2,5,main] produce value: C5
Thread[pool-1-thread-1,5,main] poll value: C5
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C6
Thread[pool-1-thread-1,5,main] poll value: C6
Thread[pool-1-thread-2,5,main] produce value: C7
Thread[pool-1-thread-1,5,main] poll value: C7
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C8
Thread[pool-1-thread-1,5,main] poll value: C8
Thread[pool-1-thread-2,5,main] produce value: C9
Thread[pool-1-thread-1,5,main] poll value: C9
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C10
Thread[pool-1-thread-1,5,main] poll value: C10
Thread[pool-1-thread-3,5,main] worker consume value: C8
Thread[pool-1-thread-3,5,main] worker consume value: C7
Thread[pool-1-thread-3,5,main] worker consume value: C9
Thread[pool-1-thread-3,5,main] worker consume value: C4
Thread[pool-1-thread-3,5,main] worker consume value: C3
Thread[pool-1-thread-3,5,main] worker consume value: C6
Thread[pool-1-thread-3,5,main] worker consume value: C5
Thread[pool-1-thread-3,5,main] worker consume value: C0
Thread[pool-1-thread-3,5,main] worker consume value: C10
Thread[pool-1-thread-3,5,main] worker consume value: C1
Thread[pool-1-thread-3,5,main] worker consume value: C2
Thread[pool-1-thread-2,5,main] produce value: C11
Thread[pool-1-thread-1,5,main] poll value: C11
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C12
Thread[pool-1-thread-1,5,main] poll value: C12
Thread[pool-1-thread-2,5,main] produce value: C13
Thread[pool-1-thread-1,5,main] poll value: C13
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C14
Thread[pool-1-thread-1,5,main] poll value: C14
Thread[pool-1-thread-2,5,main] produce value: C15
Thread[pool-1-thread-1,5,main] poll value: C15
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C16
Thread[pool-1-thread-1,5,main] poll value: C16
Thread[pool-1-thread-2,5,main] produce value: C17
Thread[pool-1-thread-1,5,main] poll value: C17
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C18
Thread[pool-1-thread-1,5,main] poll value: C18
Thread[pool-1-thread-2,5,main] produce value: C19
Thread[pool-1-thread-1,5,main] poll value: C19
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C20
Thread[pool-1-thread-1,5,main] poll value: C20
Thread[pool-1-thread-2,5,main] produce value: C21
Thread[pool-1-thread-1,5,main] poll value: C21
Thread[pool-1-thread-4,5,main] worker consume value: C16
Thread[pool-1-thread-4,5,main] worker consume value: C17
Thread[pool-1-thread-4,5,main] worker consume value: C18
Thread[pool-1-thread-4,5,main] worker consume value: C19
Thread[pool-1-thread-4,5,main] worker consume value: C11
Thread[pool-1-thread-4,5,main] worker consume value: C21
Thread[pool-1-thread-4,5,main] worker consume value: C12
Thread[pool-1-thread-4,5,main] worker consume value: C13
Thread[pool-1-thread-4,5,main] worker consume value: C14
Thread[pool-1-thread-4,5,main] worker consume value: C20
Thread[pool-1-thread-4,5,main] worker consume value: C15
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C22
Thread[pool-1-thread-1,5,main] poll value: C22
Thread[pool-1-thread-2,5,main] produce value: C23
Thread[pool-1-thread-1,5,main] poll value: C23
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C24
Thread[pool-1-thread-1,5,main] poll value: C24
Thread[pool-1-thread-2,5,main] produce value: C25
Thread[pool-1-thread-1,5,main] poll value: C25
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C26
Thread[pool-1-thread-1,5,main] poll value: C26
Thread[pool-1-thread-2,5,main] produce value: C27
Thread[pool-1-thread-1,5,main] poll value: C27
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C28
Thread[pool-1-thread-1,5,main] poll value: C28
Thread[pool-1-thread-2,5,main] produce value: C29
Thread[pool-1-thread-1,5,main] poll value: C29
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C30
Thread[pool-1-thread-1,5,main] poll value: C30
Thread[pool-1-thread-2,5,main] produce value: C31
Thread[pool-1-thread-1,5,main] poll value: C31
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C32
Thread[pool-1-thread-1,5,main] poll value: C32
Thread[pool-1-thread-5,5,main] worker consume value: C29
Thread[pool-1-thread-5,5,main] worker consume value: C27
Thread[pool-1-thread-5,5,main] worker consume value: C28
Thread[pool-1-thread-5,5,main] worker consume value: C25
Thread[pool-1-thread-5,5,main] worker consume value: C26
Thread[pool-1-thread-5,5,main] worker consume value: C23
Thread[pool-1-thread-5,5,main] worker consume value: C24
Thread[pool-1-thread-5,5,main] worker consume value: C30
Thread[pool-1-thread-5,5,main] worker consume value: C31
Thread[pool-1-thread-5,5,main] worker consume value: C22
Thread[pool-1-thread-5,5,main] worker consume value: C32
Thread[pool-1-thread-2,5,main] produce value: C33
Thread[pool-1-thread-1,5,main] poll value: C33
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C34
Thread[pool-1-thread-1,5,main] poll value: C34
Thread[pool-1-thread-2,5,main] produce value: C35
Thread[pool-1-thread-1,5,main] poll value: C35
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C36
Thread[pool-1-thread-1,5,main] poll value: C36
Thread[pool-1-thread-2,5,main] produce value: C37
Thread[pool-1-thread-1,5,main] poll value: C37
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C38
Thread[pool-1-thread-1,5,main] poll value: C38
Thread[pool-1-thread-2,5,main] produce value: C39
Thread[pool-1-thread-1,5,main] poll value: C39
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C40
Thread[pool-1-thread-1,5,main] poll value: C40
Thread[pool-1-thread-2,5,main] produce value: C41
Thread[pool-1-thread-1,5,main] poll value: C41
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C42
Thread[pool-1-thread-1,5,main] poll value: C42
Thread[pool-1-thread-2,5,main] produce value: C43
Thread[pool-1-thread-1,5,main] poll value: C43
Thread[pool-1-thread-3,5,main] worker consume value: C40
Thread[pool-1-thread-3,5,main] worker consume value: C42
Thread[pool-1-thread-3,5,main] worker consume value: C38
Thread[pool-1-thread-3,5,main] worker consume value: C41
Thread[pool-1-thread-3,5,main] worker consume value: C39
Thread[pool-1-thread-3,5,main] worker consume value: C43
Thread[pool-1-thread-3,5,main] worker consume value: C34
Thread[pool-1-thread-3,5,main] worker consume value: C35
Thread[pool-1-thread-3,5,main] worker consume value: C36
Thread[pool-1-thread-3,5,main] worker consume value: C37
Thread[pool-1-thread-3,5,main] worker consume value: C33
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C44
Thread[pool-1-thread-1,5,main] poll value: C44
Thread[pool-1-thread-2,5,main] produce value: C45
Thread[pool-1-thread-1,5,main] poll value: C45
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C46
Thread[pool-1-thread-1,5,main] poll value: C46
Thread[pool-1-thread-2,5,main] produce value: C47
Thread[pool-1-thread-1,5,main] poll value: C47
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C48
Thread[pool-1-thread-1,5,main] poll value: C48
Thread[pool-1-thread-2,5,main] produce value: C49
Thread[pool-1-thread-1,5,main] poll value: C49
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C50
Thread[pool-1-thread-1,5,main] poll value: C50
Thread[pool-1-thread-2,5,main] produce value: C51
Thread[pool-1-thread-1,5,main] poll value: C51
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C52
Thread[pool-1-thread-1,5,main] poll value: C52
Thread[pool-1-thread-2,5,main] produce value: C53
Thread[pool-1-thread-1,5,main] poll value: C53
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C54
Thread[pool-1-thread-1,5,main] poll value: C54
Thread[pool-1-thread-4,5,main] worker consume value: C46
Thread[pool-1-thread-4,5,main] worker consume value: C45
Thread[pool-1-thread-4,5,main] worker consume value: C48
Thread[pool-1-thread-4,5,main] worker consume value: C47
Thread[pool-1-thread-4,5,main] worker consume value: C54
Thread[pool-1-thread-4,5,main] worker consume value: C53
Thread[pool-1-thread-4,5,main] worker consume value: C44
Thread[pool-1-thread-4,5,main] worker consume value: C52
Thread[pool-1-thread-4,5,main] worker consume value: C50
Thread[pool-1-thread-4,5,main] worker consume value: C51
Thread[pool-1-thread-4,5,main] worker consume value: C49
Thread[pool-1-thread-2,5,main] produce value: C55
Thread[pool-1-thread-1,5,main] poll value: C55
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C56
Thread[pool-1-thread-1,5,main] poll value: C56
Thread[pool-1-thread-2,5,main] produce value: C57
Thread[pool-1-thread-1,5,main] poll value: C57
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C58
Thread[pool-1-thread-1,5,main] poll value: C58
Thread[pool-1-thread-2,5,main] produce value: C59
Thread[pool-1-thread-1,5,main] poll value: C59
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C60
Thread[pool-1-thread-1,5,main] poll value: C60
Thread[pool-1-thread-2,5,main] produce value: C61
Thread[pool-1-thread-1,5,main] poll value: C61
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C62
Thread[pool-1-thread-1,5,main] poll value: C62
Thread[pool-1-thread-2,5,main] produce value: C63
Thread[pool-1-thread-1,5,main] poll value: C63
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C64
Thread[pool-1-thread-1,5,main] poll value: C64
Thread[pool-1-thread-2,5,main] produce value: C65
Thread[pool-1-thread-1,5,main] poll value: C65
Thread[pool-1-thread-5,5,main] worker consume value: C64
Thread[pool-1-thread-5,5,main] worker consume value: C59
Thread[pool-1-thread-5,5,main] worker consume value: C63
Thread[pool-1-thread-5,5,main] worker consume value: C58
Thread[pool-1-thread-5,5,main] worker consume value: C57
Thread[pool-1-thread-5,5,main] worker consume value: C65
Thread[pool-1-thread-5,5,main] worker consume value: C56
Thread[pool-1-thread-5,5,main] worker consume value: C55
Thread[pool-1-thread-5,5,main] worker consume value: C61
Thread[pool-1-thread-5,5,main] worker consume value: C62
Thread[pool-1-thread-5,5,main] worker consume value: C60
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C66
Thread[pool-1-thread-1,5,main] poll value: C66
Thread[pool-1-thread-2,5,main] produce value: C67
Thread[pool-1-thread-1,5,main] poll value: C67
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C68
Thread[pool-1-thread-1,5,main] poll value: C68
Thread[pool-1-thread-2,5,main] produce value: C69
Thread[pool-1-thread-1,5,main] poll value: C69
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C70
Thread[pool-1-thread-1,5,main] poll value: C70
Thread[pool-1-thread-2,5,main] produce value: C71
Thread[pool-1-thread-1,5,main] poll value: C71
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C72
Thread[pool-1-thread-1,5,main] poll value: C72
Thread[pool-1-thread-2,5,main] produce value: C73
Thread[pool-1-thread-1,5,main] poll value: C73
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C74
Thread[pool-1-thread-1,5,main] poll value: C74
Thread[pool-1-thread-2,5,main] produce value: C75
Thread[pool-1-thread-1,5,main] poll value: C75
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C76
Thread[pool-1-thread-1,5,main] poll value: C76
Thread[pool-1-thread-3,5,main] worker consume value: C76
Thread[pool-1-thread-3,5,main] worker consume value: C75
Thread[pool-1-thread-3,5,main] worker consume value: C66
Thread[pool-1-thread-3,5,main] worker consume value: C74
Thread[pool-1-thread-3,5,main] worker consume value: C68
Thread[pool-1-thread-3,5,main] worker consume value: C67
Thread[pool-1-thread-3,5,main] worker consume value: C69
Thread[pool-1-thread-3,5,main] worker consume value: C70
Thread[pool-1-thread-3,5,main] worker consume value: C71
Thread[pool-1-thread-3,5,main] worker consume value: C72
Thread[pool-1-thread-3,5,main] worker consume value: C73
Thread[pool-1-thread-2,5,main] produce value: C77
Thread[pool-1-thread-1,5,main] poll value: C77
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C78
Thread[pool-1-thread-1,5,main] poll value: C78
Thread[pool-1-thread-2,5,main] produce value: C79
Thread[pool-1-thread-1,5,main] poll value: C79
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C80
Thread[pool-1-thread-1,5,main] poll value: C80
Thread[pool-1-thread-2,5,main] produce value: C81
Thread[pool-1-thread-1,5,main] poll value: C81
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C82
Thread[pool-1-thread-1,5,main] poll value: C82
Thread[pool-1-thread-2,5,main] produce value: C83
Thread[pool-1-thread-1,5,main] poll value: C83
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C84
Thread[pool-1-thread-1,5,main] poll value: C84
Thread[pool-1-thread-2,5,main] produce value: C85
Thread[pool-1-thread-1,5,main] poll value: C85
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C86
Thread[pool-1-thread-1,5,main] poll value: C86
Thread[pool-1-thread-2,5,main] produce value: C87
Thread[pool-1-thread-1,5,main] poll value: C87
Thread[pool-1-thread-4,5,main] worker consume value: C77
Thread[pool-1-thread-4,5,main] worker consume value: C79
Thread[pool-1-thread-4,5,main] worker consume value: C78
Thread[pool-1-thread-4,5,main] worker consume value: C80
Thread[pool-1-thread-4,5,main] worker consume value: C85
Thread[pool-1-thread-4,5,main] worker consume value: C83
Thread[pool-1-thread-4,5,main] worker consume value: C86
Thread[pool-1-thread-4,5,main] worker consume value: C84
Thread[pool-1-thread-4,5,main] worker consume value: C87
Thread[pool-1-thread-4,5,main] worker consume value: C81
Thread[pool-1-thread-4,5,main] worker consume value: C82
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C88
Thread[pool-1-thread-1,5,main] poll value: C88
Thread[pool-1-thread-2,5,main] produce value: C89
Thread[pool-1-thread-1,5,main] poll value: C89
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C90
Thread[pool-1-thread-1,5,main] poll value: C90
Thread[pool-1-thread-2,5,main] produce value: C91
Thread[pool-1-thread-1,5,main] poll value: C91
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C92
Thread[pool-1-thread-1,5,main] poll value: C92
Thread[pool-1-thread-2,5,main] produce value: C93
Thread[pool-1-thread-1,5,main] poll value: C93
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C94
Thread[pool-1-thread-1,5,main] poll value: C94
Thread[pool-1-thread-2,5,main] produce value: C95
Thread[pool-1-thread-1,5,main] poll value: C95
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C96
Thread[pool-1-thread-1,5,main] poll value: C96
Thread[pool-1-thread-2,5,main] produce value: C97
Thread[pool-1-thread-1,5,main] poll value: C97
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: C98
Thread[pool-1-thread-1,5,main] poll value: C98
Thread[pool-1-thread-5,5,main] worker consume value: C93
Thread[pool-1-thread-5,5,main] worker consume value: C92
Thread[pool-1-thread-5,5,main] worker consume value: C95
Thread[pool-1-thread-5,5,main] worker consume value: C94
Thread[pool-1-thread-5,5,main] worker consume value: C91
Thread[pool-1-thread-5,5,main] worker consume value: C90
Thread[pool-1-thread-5,5,main] worker consume value: C89
Thread[pool-1-thread-5,5,main] worker consume value: C98
Thread[pool-1-thread-5,5,main] worker consume value: C96
Thread[pool-1-thread-5,5,main] worker consume value: C97
Thread[pool-1-thread-5,5,main] worker consume value: C88
Thread[pool-1-thread-2,5,main] produce value: C99
Thread[pool-1-thread-1,5,main] poll value: C99
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A0
Thread[pool-1-thread-1,5,main] poll value: A0
Thread[pool-1-thread-2,5,main] produce value: A1
Thread[pool-1-thread-1,5,main] poll value: A1
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A2
Thread[pool-1-thread-1,5,main] poll value: A2
Thread[pool-1-thread-2,5,main] produce value: A3
Thread[pool-1-thread-1,5,main] poll value: A3
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A4
Thread[pool-1-thread-1,5,main] poll value: A4
Thread[pool-1-thread-2,5,main] produce value: A5
Thread[pool-1-thread-1,5,main] poll value: A5
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A6
Thread[pool-1-thread-1,5,main] poll value: A6
Thread[pool-1-thread-2,5,main] produce value: A7
Thread[pool-1-thread-1,5,main] poll value: A7
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A8
Thread[pool-1-thread-1,5,main] poll value: A8
Thread[pool-1-thread-2,5,main] produce value: A9
Thread[pool-1-thread-1,5,main] poll value: A9
Thread[pool-1-thread-3,5,main] worker consume value: A2
Thread[pool-1-thread-3,5,main] worker consume value: A1
Thread[pool-1-thread-3,5,main] worker consume value: A4
Thread[pool-1-thread-3,5,main] worker consume value: A3
Thread[pool-1-thread-3,5,main] worker consume value: A6
Thread[pool-1-thread-3,5,main] worker consume value: A5
Thread[pool-1-thread-3,5,main] worker consume value: A8
Thread[pool-1-thread-3,5,main] worker consume value: A7
Thread[pool-1-thread-3,5,main] worker consume value: A9
Thread[pool-1-thread-3,5,main] worker consume value: C99
Thread[pool-1-thread-3,5,main] worker consume value: A0
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A10
Thread[pool-1-thread-1,5,main] poll value: A10
Thread[pool-1-thread-2,5,main] produce value: A11
Thread[pool-1-thread-1,5,main] poll value: A11
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A12
Thread[pool-1-thread-1,5,main] poll value: A12
Thread[pool-1-thread-2,5,main] produce value: A13
Thread[pool-1-thread-1,5,main] poll value: A13
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A14
Thread[pool-1-thread-1,5,main] poll value: A14
Thread[pool-1-thread-2,5,main] produce value: A15
Thread[pool-1-thread-1,5,main] poll value: A15
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A16
Thread[pool-1-thread-1,5,main] poll value: A16
Thread[pool-1-thread-2,5,main] produce value: A17
Thread[pool-1-thread-1,5,main] poll value: A17
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A18
Thread[pool-1-thread-1,5,main] poll value: A18
Thread[pool-1-thread-2,5,main] produce value: A19
Thread[pool-1-thread-1,5,main] poll value: A19
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A20
Thread[pool-1-thread-1,5,main] poll value: A20
Thread[pool-1-thread-4,5,main] worker consume value: A19
Thread[pool-1-thread-4,5,main] worker consume value: A18
Thread[pool-1-thread-4,5,main] worker consume value: A20
Thread[pool-1-thread-4,5,main] worker consume value: A11
Thread[pool-1-thread-4,5,main] worker consume value: A10
Thread[pool-1-thread-4,5,main] worker consume value: A13
Thread[pool-1-thread-4,5,main] worker consume value: A12
Thread[pool-1-thread-4,5,main] worker consume value: A15
Thread[pool-1-thread-4,5,main] worker consume value: A14
Thread[pool-1-thread-4,5,main] worker consume value: A17
Thread[pool-1-thread-4,5,main] worker consume value: A16
Thread[pool-1-thread-2,5,main] produce value: A21
Thread[pool-1-thread-1,5,main] poll value: A21
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A22
Thread[pool-1-thread-1,5,main] poll value: A22
Thread[pool-1-thread-2,5,main] produce value: A23
Thread[pool-1-thread-1,5,main] poll value: A23
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A24
Thread[pool-1-thread-1,5,main] poll value: A24
Thread[pool-1-thread-2,5,main] produce value: A25
Thread[pool-1-thread-1,5,main] poll value: A25
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A26
Thread[pool-1-thread-1,5,main] poll value: A26
Thread[pool-1-thread-2,5,main] produce value: A27
Thread[pool-1-thread-1,5,main] poll value: A27
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A28
Thread[pool-1-thread-1,5,main] poll value: A28
Thread[pool-1-thread-2,5,main] produce value: A29
Thread[pool-1-thread-1,5,main] poll value: A29
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A30
Thread[pool-1-thread-1,5,main] poll value: A30
Thread[pool-1-thread-2,5,main] produce value: A31
Thread[pool-1-thread-1,5,main] poll value: A31
Thread[pool-1-thread-5,5,main] worker consume value: A30
Thread[pool-1-thread-5,5,main] worker consume value: A31
Thread[pool-1-thread-5,5,main] worker consume value: A29
Thread[pool-1-thread-5,5,main] worker consume value: A28
Thread[pool-1-thread-5,5,main] worker consume value: A27
Thread[pool-1-thread-5,5,main] worker consume value: A26
Thread[pool-1-thread-5,5,main] worker consume value: A25
Thread[pool-1-thread-5,5,main] worker consume value: A24
Thread[pool-1-thread-5,5,main] worker consume value: A23
Thread[pool-1-thread-5,5,main] worker consume value: A22
Thread[pool-1-thread-5,5,main] worker consume value: A21
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A32
Thread[pool-1-thread-1,5,main] poll value: A32
Thread[pool-1-thread-2,5,main] produce value: A33
Thread[pool-1-thread-1,5,main] poll value: A33
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A34
Thread[pool-1-thread-1,5,main] poll value: A34
Thread[pool-1-thread-2,5,main] produce value: A35
Thread[pool-1-thread-1,5,main] poll value: A35
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A36
Thread[pool-1-thread-1,5,main] poll value: A36
Thread[pool-1-thread-2,5,main] produce value: A37
Thread[pool-1-thread-1,5,main] poll value: A37
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A38
Thread[pool-1-thread-1,5,main] poll value: A38
Thread[pool-1-thread-2,5,main] produce value: A39
Thread[pool-1-thread-1,5,main] poll value: A39
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A40
Thread[pool-1-thread-1,5,main] poll value: A40
Thread[pool-1-thread-2,5,main] produce value: A41
Thread[pool-1-thread-1,5,main] poll value: A41
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A42
Thread[pool-1-thread-1,5,main] poll value: A42
Thread[pool-1-thread-3,5,main] worker consume value: A40
Thread[pool-1-thread-3,5,main] worker consume value: A41
Thread[pool-1-thread-3,5,main] worker consume value: A42
Thread[pool-1-thread-3,5,main] worker consume value: A37
Thread[pool-1-thread-3,5,main] worker consume value: A36
Thread[pool-1-thread-3,5,main] worker consume value: A39
Thread[pool-1-thread-3,5,main] worker consume value: A38
Thread[pool-1-thread-3,5,main] worker consume value: A33
Thread[pool-1-thread-3,5,main] worker consume value: A32
Thread[pool-1-thread-3,5,main] worker consume value: A35
Thread[pool-1-thread-3,5,main] worker consume value: A34
Thread[pool-1-thread-2,5,main] produce value: A43
Thread[pool-1-thread-1,5,main] poll value: A43
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A44
Thread[pool-1-thread-1,5,main] poll value: A44
Thread[pool-1-thread-2,5,main] produce value: A45
Thread[pool-1-thread-1,5,main] poll value: A45
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A46
Thread[pool-1-thread-1,5,main] poll value: A46
Thread[pool-1-thread-2,5,main] produce value: A47
Thread[pool-1-thread-1,5,main] poll value: A47
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A48
Thread[pool-1-thread-1,5,main] poll value: A48
Thread[pool-1-thread-2,5,main] produce value: A49
Thread[pool-1-thread-1,5,main] poll value: A49
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A50
Thread[pool-1-thread-1,5,main] poll value: A50
Thread[pool-1-thread-2,5,main] produce value: A51
Thread[pool-1-thread-1,5,main] poll value: A51
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A52
Thread[pool-1-thread-1,5,main] poll value: A52
Thread[pool-1-thread-2,5,main] produce value: A53
Thread[pool-1-thread-1,5,main] poll value: A53
Thread[pool-1-thread-4,5,main] worker consume value: A45
Thread[pool-1-thread-4,5,main] worker consume value: A46
Thread[pool-1-thread-4,5,main] worker consume value: A43
Thread[pool-1-thread-4,5,main] worker consume value: A44
Thread[pool-1-thread-4,5,main] worker consume value: A49
Thread[pool-1-thread-4,5,main] worker consume value: A47
Thread[pool-1-thread-4,5,main] worker consume value: A48
Thread[pool-1-thread-4,5,main] worker consume value: A53
Thread[pool-1-thread-4,5,main] worker consume value: A52
Thread[pool-1-thread-4,5,main] worker consume value: A51
Thread[pool-1-thread-4,5,main] worker consume value: A50
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A54
Thread[pool-1-thread-1,5,main] poll value: A54
Thread[pool-1-thread-2,5,main] produce value: A55
Thread[pool-1-thread-1,5,main] poll value: A55
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A56
Thread[pool-1-thread-1,5,main] poll value: A56
Thread[pool-1-thread-2,5,main] produce value: A57
Thread[pool-1-thread-1,5,main] poll value: A57
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A58
Thread[pool-1-thread-1,5,main] poll value: A58
Thread[pool-1-thread-2,5,main] produce value: A59
Thread[pool-1-thread-1,5,main] poll value: A59
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A60
Thread[pool-1-thread-1,5,main] poll value: A60
Thread[pool-1-thread-2,5,main] produce value: A61
Thread[pool-1-thread-1,5,main] poll value: A61
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A62
Thread[pool-1-thread-1,5,main] poll value: A62
Thread[pool-1-thread-2,5,main] produce value: A63
Thread[pool-1-thread-1,5,main] poll value: A63
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A64
Thread[pool-1-thread-1,5,main] poll value: A64
Thread[pool-1-thread-5,5,main] worker consume value: A54
Thread[pool-1-thread-5,5,main] worker consume value: A55
Thread[pool-1-thread-5,5,main] worker consume value: A56
Thread[pool-1-thread-5,5,main] worker consume value: A57
Thread[pool-1-thread-5,5,main] worker consume value: A58
Thread[pool-1-thread-5,5,main] worker consume value: A59
Thread[pool-1-thread-5,5,main] worker consume value: A60
Thread[pool-1-thread-5,5,main] worker consume value: A62
Thread[pool-1-thread-5,5,main] worker consume value: A61
Thread[pool-1-thread-5,5,main] worker consume value: A64
Thread[pool-1-thread-5,5,main] worker consume value: A63
Thread[pool-1-thread-2,5,main] produce value: A65
Thread[pool-1-thread-1,5,main] poll value: A65
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A66
Thread[pool-1-thread-1,5,main] poll value: A66
Thread[pool-1-thread-2,5,main] produce value: A67
Thread[pool-1-thread-1,5,main] poll value: A67
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A68
Thread[pool-1-thread-1,5,main] poll value: A68
Thread[pool-1-thread-2,5,main] produce value: A69
Thread[pool-1-thread-1,5,main] poll value: A69
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A70
Thread[pool-1-thread-1,5,main] poll value: A70
Thread[pool-1-thread-2,5,main] produce value: A71
Thread[pool-1-thread-1,5,main] poll value: A71
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A72
Thread[pool-1-thread-1,5,main] poll value: A72
Thread[pool-1-thread-2,5,main] produce value: A73
Thread[pool-1-thread-1,5,main] poll value: A73
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A74
Thread[pool-1-thread-1,5,main] poll value: A74
Thread[pool-1-thread-2,5,main] produce value: A75
Thread[pool-1-thread-1,5,main] poll value: A75
Thread[pool-1-thread-3,5,main] worker consume value: A69
Thread[pool-1-thread-3,5,main] worker consume value: A67
Thread[pool-1-thread-3,5,main] worker consume value: A68
Thread[pool-1-thread-3,5,main] worker consume value: A65
Thread[pool-1-thread-3,5,main] worker consume value: A66
Thread[pool-1-thread-3,5,main] worker consume value: A75
Thread[pool-1-thread-3,5,main] worker consume value: A74
Thread[pool-1-thread-3,5,main] worker consume value: A73
Thread[pool-1-thread-3,5,main] worker consume value: A72
Thread[pool-1-thread-3,5,main] worker consume value: A71
Thread[pool-1-thread-3,5,main] worker consume value: A70
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A76
Thread[pool-1-thread-1,5,main] poll value: A76
Thread[pool-1-thread-2,5,main] produce value: A77
Thread[pool-1-thread-1,5,main] poll value: A77
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A78
Thread[pool-1-thread-1,5,main] poll value: A78
Thread[pool-1-thread-2,5,main] produce value: A79
Thread[pool-1-thread-1,5,main] poll value: A79
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A80
Thread[pool-1-thread-1,5,main] poll value: A80
Thread[pool-1-thread-2,5,main] produce value: A81
Thread[pool-1-thread-1,5,main] poll value: A81
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A82
Thread[pool-1-thread-1,5,main] poll value: A82
Thread[pool-1-thread-2,5,main] produce value: A83
Thread[pool-1-thread-1,5,main] poll value: A83
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A84
Thread[pool-1-thread-1,5,main] poll value: A84
Thread[pool-1-thread-2,5,main] produce value: A85
Thread[pool-1-thread-1,5,main] poll value: A85
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A86
Thread[pool-1-thread-1,5,main] poll value: A86
Thread[pool-1-thread-4,5,main] worker consume value: A76
Thread[pool-1-thread-4,5,main] worker consume value: A77
Thread[pool-1-thread-4,5,main] worker consume value: A78
Thread[pool-1-thread-4,5,main] worker consume value: A79
Thread[pool-1-thread-4,5,main] worker consume value: A84
Thread[pool-1-thread-4,5,main] worker consume value: A83
Thread[pool-1-thread-4,5,main] worker consume value: A86
Thread[pool-1-thread-4,5,main] worker consume value: A85
Thread[pool-1-thread-4,5,main] worker consume value: A80
Thread[pool-1-thread-4,5,main] worker consume value: A82
Thread[pool-1-thread-4,5,main] worker consume value: A81
Thread[pool-1-thread-2,5,main] produce value: A87
Thread[pool-1-thread-1,5,main] poll value: A87
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A88
Thread[pool-1-thread-1,5,main] poll value: A88
Thread[pool-1-thread-2,5,main] produce value: A89
Thread[pool-1-thread-1,5,main] poll value: A89
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A90
Thread[pool-1-thread-1,5,main] poll value: A90
Thread[pool-1-thread-2,5,main] produce value: A91
Thread[pool-1-thread-1,5,main] poll value: A91
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A92
Thread[pool-1-thread-1,5,main] poll value: A92
Thread[pool-1-thread-2,5,main] produce value: A93
Thread[pool-1-thread-1,5,main] poll value: A93
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A94
Thread[pool-1-thread-1,5,main] poll value: A94
Thread[pool-1-thread-2,5,main] produce value: A95
Thread[pool-1-thread-1,5,main] poll value: A95
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A96
Thread[pool-1-thread-1,5,main] poll value: A96
Thread[pool-1-thread-2,5,main] produce value: A97
Thread[pool-1-thread-1,5,main] poll value: A97
Thread[pool-1-thread-5,5,main] worker consume value: A90
Thread[pool-1-thread-5,5,main] worker consume value: A91
Thread[pool-1-thread-5,5,main] worker consume value: A92
Thread[pool-1-thread-5,5,main] worker consume value: A93
Thread[pool-1-thread-5,5,main] worker consume value: A94
Thread[pool-1-thread-5,5,main] worker consume value: A95
Thread[pool-1-thread-5,5,main] worker consume value: A96
Thread[pool-1-thread-5,5,main] worker consume value: A97
Thread[pool-1-thread-5,5,main] worker consume value: A88
Thread[pool-1-thread-5,5,main] worker consume value: A87
Thread[pool-1-thread-5,5,main] worker consume value: A89
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A98
Thread[pool-1-thread-1,5,main] poll value: A98
Thread[pool-1-thread-2,5,main] produce value: A99
Thread[pool-1-thread-1,5,main] poll value: A99
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A0
Thread[pool-1-thread-1,5,main] poll value: A0
Thread[pool-1-thread-2,5,main] produce value: A1
Thread[pool-1-thread-1,5,main] poll value: A1
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A2
Thread[pool-1-thread-1,5,main] poll value: A2
Thread[pool-1-thread-2,5,main] produce value: A3
Thread[pool-1-thread-1,5,main] poll value: A3
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A4
Thread[pool-1-thread-1,5,main] poll value: A4
Thread[pool-1-thread-2,5,main] produce value: A5
Thread[pool-1-thread-1,5,main] poll value: A5
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A6
Thread[pool-1-thread-1,5,main] poll value: A6
Thread[pool-1-thread-2,5,main] produce value: A7
Thread[pool-1-thread-1,5,main] poll value: A7
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A8
Thread[pool-1-thread-1,5,main] poll value: A8
Thread[pool-1-thread-3,5,main] worker consume value: A2
Thread[pool-1-thread-3,5,main] worker consume value: A1
Thread[pool-1-thread-3,5,main] worker consume value: A4
Thread[pool-1-thread-3,5,main] worker consume value: A3
Thread[pool-1-thread-3,5,main] worker consume value: A6
Thread[pool-1-thread-3,5,main] worker consume value: A5
Thread[pool-1-thread-3,5,main] worker consume value: A8
Thread[pool-1-thread-3,5,main] worker consume value: A7
Thread[pool-1-thread-3,5,main] worker consume value: A99
Thread[pool-1-thread-3,5,main] worker consume value: A98
Thread[pool-1-thread-3,5,main] worker consume value: A0
Thread[pool-1-thread-2,5,main] produce value: A9
Thread[pool-1-thread-1,5,main] poll value: A9
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A10
Thread[pool-1-thread-1,5,main] poll value: A10
Thread[pool-1-thread-2,5,main] produce value: A11
Thread[pool-1-thread-1,5,main] poll value: A11
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A12
Thread[pool-1-thread-1,5,main] poll value: A12
Thread[pool-1-thread-2,5,main] produce value: A13
Thread[pool-1-thread-1,5,main] poll value: A13
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A14
Thread[pool-1-thread-1,5,main] poll value: A14
Thread[pool-1-thread-2,5,main] produce value: A15
Thread[pool-1-thread-1,5,main] poll value: A15
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A16
Thread[pool-1-thread-1,5,main] poll value: A16
Thread[pool-1-thread-2,5,main] produce value: A17
Thread[pool-1-thread-1,5,main] poll value: A17
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A18
Thread[pool-1-thread-1,5,main] poll value: A18
Thread[pool-1-thread-2,5,main] produce value: A19
Thread[pool-1-thread-1,5,main] poll value: A19
Thread[pool-1-thread-4,5,main] worker consume value: A19
Thread[pool-1-thread-4,5,main] worker consume value: A18
Thread[pool-1-thread-4,5,main] worker consume value: A11
Thread[pool-1-thread-4,5,main] worker consume value: A10
Thread[pool-1-thread-4,5,main] worker consume value: A9
Thread[pool-1-thread-4,5,main] worker consume value: A13
Thread[pool-1-thread-4,5,main] worker consume value: A12
Thread[pool-1-thread-4,5,main] worker consume value: A15
Thread[pool-1-thread-4,5,main] worker consume value: A14
Thread[pool-1-thread-4,5,main] worker consume value: A17
Thread[pool-1-thread-4,5,main] worker consume value: A16
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A20
Thread[pool-1-thread-1,5,main] poll value: A20
Thread[pool-1-thread-2,5,main] produce value: A21
Thread[pool-1-thread-1,5,main] poll value: A21
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A22
Thread[pool-1-thread-1,5,main] poll value: A22
Thread[pool-1-thread-2,5,main] produce value: A23
Thread[pool-1-thread-1,5,main] poll value: A23
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A24
Thread[pool-1-thread-1,5,main] poll value: A24
Thread[pool-1-thread-2,5,main] produce value: A25
Thread[pool-1-thread-1,5,main] poll value: A25
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A26
Thread[pool-1-thread-1,5,main] poll value: A26
Thread[pool-1-thread-2,5,main] produce value: A27
Thread[pool-1-thread-1,5,main] poll value: A27
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A28
Thread[pool-1-thread-1,5,main] poll value: A28
Thread[pool-1-thread-2,5,main] produce value: A29
Thread[pool-1-thread-1,5,main] poll value: A29
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A30
Thread[pool-1-thread-1,5,main] poll value: A30
Thread[pool-1-thread-5,5,main] worker consume value: A30
Thread[pool-1-thread-5,5,main] worker consume value: A29
Thread[pool-1-thread-5,5,main] worker consume value: A20
Thread[pool-1-thread-5,5,main] worker consume value: A28
Thread[pool-1-thread-5,5,main] worker consume value: A27
Thread[pool-1-thread-5,5,main] worker consume value: A26
Thread[pool-1-thread-5,5,main] worker consume value: A25
Thread[pool-1-thread-5,5,main] worker consume value: A24
Thread[pool-1-thread-5,5,main] worker consume value: A23
Thread[pool-1-thread-5,5,main] worker consume value: A22
Thread[pool-1-thread-5,5,main] worker consume value: A21
Thread[pool-1-thread-2,5,main] produce value: A31
Thread[pool-1-thread-1,5,main] poll value: A31
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A32
Thread[pool-1-thread-1,5,main] poll value: A32
Thread[pool-1-thread-2,5,main] produce value: A33
Thread[pool-1-thread-1,5,main] poll value: A33
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A34
Thread[pool-1-thread-1,5,main] poll value: A34
Thread[pool-1-thread-2,5,main] produce value: A35
Thread[pool-1-thread-1,5,main] poll value: A35
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A36
Thread[pool-1-thread-1,5,main] poll value: A36
Thread[pool-1-thread-2,5,main] produce value: A37
Thread[pool-1-thread-1,5,main] poll value: A37
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A38
Thread[pool-1-thread-1,5,main] poll value: A38
Thread[pool-1-thread-2,5,main] produce value: A39
Thread[pool-1-thread-1,5,main] poll value: A39
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A40
Thread[pool-1-thread-1,5,main] poll value: A40
Thread[pool-1-thread-2,5,main] produce value: A41
Thread[pool-1-thread-1,5,main] poll value: A41
Thread[pool-1-thread-3,5,main] worker consume value: A40
Thread[pool-1-thread-3,5,main] worker consume value: A31
Thread[pool-1-thread-3,5,main] worker consume value: A41
Thread[pool-1-thread-3,5,main] worker consume value: A37
Thread[pool-1-thread-3,5,main] worker consume value: A36
Thread[pool-1-thread-3,5,main] worker consume value: A39
Thread[pool-1-thread-3,5,main] worker consume value: A38
Thread[pool-1-thread-3,5,main] worker consume value: A33
Thread[pool-1-thread-3,5,main] worker consume value: A32
Thread[pool-1-thread-3,5,main] worker consume value: A35
Thread[pool-1-thread-3,5,main] worker consume value: A34
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A42
Thread[pool-1-thread-1,5,main] poll value: A42
Thread[pool-1-thread-2,5,main] produce value: A43
Thread[pool-1-thread-1,5,main] poll value: A43
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A44
Thread[pool-1-thread-1,5,main] poll value: A44
Thread[pool-1-thread-2,5,main] produce value: A45
Thread[pool-1-thread-1,5,main] poll value: A45
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A46
Thread[pool-1-thread-1,5,main] poll value: A46
Thread[pool-1-thread-2,5,main] produce value: A47
Thread[pool-1-thread-1,5,main] poll value: A47
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A48
Thread[pool-1-thread-1,5,main] poll value: A48
Thread[pool-1-thread-2,5,main] produce value: A49
Thread[pool-1-thread-1,5,main] poll value: A49
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A50
Thread[pool-1-thread-1,5,main] poll value: A50
Thread[pool-1-thread-2,5,main] produce value: A51
Thread[pool-1-thread-1,5,main] poll value: A51
Thread[pool-1-thread-2,5,main] produce value: A52
Thread[pool-1-thread-1,5,main] poll value: A52
Thread[pool-1-thread-4,5,main] worker consume value: A45
Thread[pool-1-thread-4,5,main] worker consume value: A46
Thread[pool-1-thread-4,5,main] worker consume value: A43
Thread[pool-1-thread-4,5,main] worker consume value: A44
Thread[pool-1-thread-4,5,main] worker consume value: A42
Thread[pool-1-thread-4,5,main] worker consume value: A49
Thread[pool-1-thread-4,5,main] worker consume value: A47
Thread[pool-1-thread-4,5,main] worker consume value: A48
Thread[pool-1-thread-4,5,main] worker consume value: A52
Thread[pool-1-thread-4,5,main] worker consume value: A51
Thread[pool-1-thread-4,5,main] worker consume value: A50
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A53
Thread[pool-1-thread-1,5,main] poll value: A53
Thread[pool-1-thread-2,5,main] produce value: A54
Thread[pool-1-thread-1,5,main] poll value: A54
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A55
Thread[pool-1-thread-1,5,main] poll value: A55
Thread[pool-1-thread-2,5,main] produce value: A56
Thread[pool-1-thread-1,5,main] poll value: A56
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A57
Thread[pool-1-thread-1,5,main] poll value: A57
Thread[pool-1-thread-2,5,main] produce value: A58
Thread[pool-1-thread-1,5,main] poll value: A58
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A59
Thread[pool-1-thread-1,5,main] poll value: A59
Thread[pool-1-thread-2,5,main] produce value: A60
Thread[pool-1-thread-1,5,main] poll value: A60
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A61
Thread[pool-1-thread-1,5,main] poll value: A61
Thread[pool-1-thread-2,5,main] produce value: A62
Thread[pool-1-thread-1,5,main] poll value: A62
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A63
Thread[pool-1-thread-1,5,main] poll value: A63
Thread[pool-1-thread-5,5,main] worker consume value: A54
Thread[pool-1-thread-5,5,main] worker consume value: A55
Thread[pool-1-thread-5,5,main] worker consume value: A56
Thread[pool-1-thread-5,5,main] worker consume value: A57
Thread[pool-1-thread-5,5,main] worker consume value: A58
Thread[pool-1-thread-5,5,main] worker consume value: A59
Thread[pool-1-thread-5,5,main] worker consume value: A60
Thread[pool-1-thread-5,5,main] worker consume value: A62
Thread[pool-1-thread-5,5,main] worker consume value: A53
Thread[pool-1-thread-5,5,main] worker consume value: A61
Thread[pool-1-thread-5,5,main] worker consume value: A63
Thread[pool-1-thread-2,5,main] produce value: A64
Thread[pool-1-thread-1,5,main] poll value: A64
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A65
Thread[pool-1-thread-1,5,main] poll value: A65
Thread[pool-1-thread-2,5,main] produce value: A66
Thread[pool-1-thread-1,5,main] poll value: A66
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A67
Thread[pool-1-thread-1,5,main] poll value: A67
Thread[pool-1-thread-2,5,main] produce value: A68
Thread[pool-1-thread-1,5,main] poll value: A68
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A69
Thread[pool-1-thread-1,5,main] poll value: A69
Thread[pool-1-thread-2,5,main] produce value: A70
Thread[pool-1-thread-1,5,main] poll value: A70
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A71
Thread[pool-1-thread-1,5,main] poll value: A71
Thread[pool-1-thread-2,5,main] produce value: A72
Thread[pool-1-thread-1,5,main] poll value: A72
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A73
Thread[pool-1-thread-1,5,main] poll value: A73
Thread[pool-1-thread-2,5,main] produce value: A74
Thread[pool-1-thread-1,5,main] poll value: A74
Thread[pool-1-thread-3,5,main] worker consume value: A69
Thread[pool-1-thread-3,5,main] worker consume value: A67
Thread[pool-1-thread-3,5,main] worker consume value: A68
Thread[pool-1-thread-3,5,main] worker consume value: A65
Thread[pool-1-thread-3,5,main] worker consume value: A66
Thread[pool-1-thread-3,5,main] worker consume value: A74
Thread[pool-1-thread-3,5,main] worker consume value: A73
Thread[pool-1-thread-3,5,main] worker consume value: A72
Thread[pool-1-thread-3,5,main] worker consume value: A71
Thread[pool-1-thread-3,5,main] worker consume value: A70
Thread[pool-1-thread-3,5,main] worker consume value: A64
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A75
Thread[pool-1-thread-1,5,main] poll value: A75
Thread[pool-1-thread-2,5,main] produce value: A76
Thread[pool-1-thread-1,5,main] poll value: A76
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A77
Thread[pool-1-thread-1,5,main] poll value: A77
Thread[pool-1-thread-2,5,main] produce value: A78
Thread[pool-1-thread-1,5,main] poll value: A78
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A79
Thread[pool-1-thread-1,5,main] poll value: A79
Thread[pool-1-thread-2,5,main] produce value: A80
Thread[pool-1-thread-1,5,main] poll value: A80
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A81
Thread[pool-1-thread-1,5,main] poll value: A81
Thread[pool-1-thread-2,5,main] produce value: A82
Thread[pool-1-thread-1,5,main] poll value: A82
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A83
Thread[pool-1-thread-1,5,main] poll value: A83
Thread[pool-1-thread-2,5,main] produce value: A84
Thread[pool-1-thread-1,5,main] poll value: A84
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A85
Thread[pool-1-thread-1,5,main] poll value: A85
Thread[pool-1-thread-4,5,main] worker consume value: A76
Thread[pool-1-thread-4,5,main] worker consume value: A77
Thread[pool-1-thread-4,5,main] worker consume value: A78
Thread[pool-1-thread-4,5,main] worker consume value: A79
Thread[pool-1-thread-4,5,main] worker consume value: A84
Thread[pool-1-thread-4,5,main] worker consume value: A75
Thread[pool-1-thread-4,5,main] worker consume value: A83
Thread[pool-1-thread-4,5,main] worker consume value: A85
Thread[pool-1-thread-4,5,main] worker consume value: A80
Thread[pool-1-thread-4,5,main] worker consume value: A82
Thread[pool-1-thread-4,5,main] worker consume value: A81
Thread[pool-1-thread-2,5,main] produce value: A86
Thread[pool-1-thread-1,5,main] poll value: A86
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A87
Thread[pool-1-thread-1,5,main] poll value: A87
Thread[pool-1-thread-2,5,main] produce value: A88
Thread[pool-1-thread-1,5,main] poll value: A88
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A89
Thread[pool-1-thread-1,5,main] poll value: A89
Thread[pool-1-thread-2,5,main] produce value: A90
Thread[pool-1-thread-1,5,main] poll value: A90
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A91
Thread[pool-1-thread-1,5,main] poll value: A91
Thread[pool-1-thread-2,5,main] produce value: A92
Thread[pool-1-thread-1,5,main] poll value: A92
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A93
Thread[pool-1-thread-1,5,main] poll value: A93
Thread[pool-1-thread-2,5,main] produce value: A94
Thread[pool-1-thread-1,5,main] poll value: A94
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A95
Thread[pool-1-thread-1,5,main] poll value: A95
Thread[pool-1-thread-2,5,main] produce value: A96
Thread[pool-1-thread-1,5,main] poll value: A96
Thread[pool-1-thread-5,5,main] worker consume value: A90
Thread[pool-1-thread-5,5,main] worker consume value: A91
Thread[pool-1-thread-5,5,main] worker consume value: A92
Thread[pool-1-thread-5,5,main] worker consume value: A93
Thread[pool-1-thread-5,5,main] worker consume value: A94
Thread[pool-1-thread-5,5,main] worker consume value: A95
Thread[pool-1-thread-5,5,main] worker consume value: A96
Thread[pool-1-thread-5,5,main] worker consume value: A88
Thread[pool-1-thread-5,5,main] worker consume value: A87
Thread[pool-1-thread-5,5,main] worker consume value: A86
Thread[pool-1-thread-5,5,main] worker consume value: A89
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A97
Thread[pool-1-thread-1,5,main] poll value: A97
Thread[pool-1-thread-2,5,main] produce value: A98
Thread[pool-1-thread-1,5,main] poll value: A98
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A99
Thread[pool-1-thread-1,5,main] poll value: A99
Thread[pool-1-thread-2,5,main] produce value: A0
Thread[pool-1-thread-1,5,main] poll value: A0
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A1
Thread[pool-1-thread-1,5,main] poll value: A1
Thread[pool-1-thread-2,5,main] produce value: A2
Thread[pool-1-thread-1,5,main] poll value: A2
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A3
Thread[pool-1-thread-1,5,main] poll value: A3
Thread[pool-1-thread-2,5,main] produce value: A4
Thread[pool-1-thread-1,5,main] poll value: A4
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A5
Thread[pool-1-thread-1,5,main] poll value: A5
Thread[pool-1-thread-2,5,main] produce value: A6
Thread[pool-1-thread-1,5,main] poll value: A6
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A7
Thread[pool-1-thread-1,5,main] poll value: A7
Thread[pool-1-thread-3,5,main] worker consume value: A2
Thread[pool-1-thread-3,5,main] worker consume value: A1
Thread[pool-1-thread-3,5,main] worker consume value: A4
Thread[pool-1-thread-3,5,main] worker consume value: A3
Thread[pool-1-thread-3,5,main] worker consume value: A6
Thread[pool-1-thread-3,5,main] worker consume value: A5
Thread[pool-1-thread-3,5,main] worker consume value: A7
Thread[pool-1-thread-3,5,main] worker consume value: A97
Thread[pool-1-thread-3,5,main] worker consume value: A99
Thread[pool-1-thread-3,5,main] worker consume value: A98
Thread[pool-1-thread-3,5,main] worker consume value: A0
Thread[pool-1-thread-2,5,main] produce value: A8
Thread[pool-1-thread-1,5,main] poll value: A8
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A9
Thread[pool-1-thread-1,5,main] poll value: A9
Thread[pool-1-thread-2,5,main] produce value: A10
Thread[pool-1-thread-1,5,main] poll value: A10
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A11
Thread[pool-1-thread-1,5,main] poll value: A11
Thread[pool-1-thread-2,5,main] produce value: A12
Thread[pool-1-thread-1,5,main] poll value: A12
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A13
Thread[pool-1-thread-1,5,main] poll value: A13
Thread[pool-1-thread-2,5,main] produce value: A14
Thread[pool-1-thread-1,5,main] poll value: A14
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A15
Thread[pool-1-thread-1,5,main] poll value: A15
Thread[pool-1-thread-2,5,main] produce value: A16
Thread[pool-1-thread-1,5,main] poll value: A16
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A17
Thread[pool-1-thread-1,5,main] poll value: A17
Thread[pool-1-thread-2,5,main] produce value: A18
Thread[pool-1-thread-1,5,main] poll value: A18
Thread[pool-1-thread-4,5,main] worker consume value: A18
Thread[pool-1-thread-4,5,main] worker consume value: A8
Thread[pool-1-thread-4,5,main] worker consume value: A11
Thread[pool-1-thread-4,5,main] worker consume value: A10
Thread[pool-1-thread-4,5,main] worker consume value: A9
Thread[pool-1-thread-4,5,main] worker consume value: A13
Thread[pool-1-thread-4,5,main] worker consume value: A12
Thread[pool-1-thread-4,5,main] worker consume value: A15
Thread[pool-1-thread-4,5,main] worker consume value: A14
Thread[pool-1-thread-4,5,main] worker consume value: A17
Thread[pool-1-thread-4,5,main] worker consume value: A16
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A19
Thread[pool-1-thread-1,5,main] poll value: A19
Thread[pool-1-thread-2,5,main] produce value: A20
Thread[pool-1-thread-1,5,main] poll value: A20
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A21
Thread[pool-1-thread-1,5,main] poll value: A21
Thread[pool-1-thread-2,5,main] produce value: A22
Thread[pool-1-thread-1,5,main] poll value: A22
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A23
Thread[pool-1-thread-1,5,main] poll value: A23
Thread[pool-1-thread-2,5,main] produce value: A24
Thread[pool-1-thread-1,5,main] poll value: A24
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A25
Thread[pool-1-thread-1,5,main] poll value: A25
Thread[pool-1-thread-2,5,main] produce value: A26
Thread[pool-1-thread-1,5,main] poll value: A26
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A27
Thread[pool-1-thread-1,5,main] poll value: A27
Thread[pool-1-thread-2,5,main] produce value: A28
Thread[pool-1-thread-1,5,main] poll value: A28
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A29
Thread[pool-1-thread-1,5,main] poll value: A29
Thread[pool-1-thread-5,5,main] worker consume value: A19
Thread[pool-1-thread-5,5,main] worker consume value: A29
Thread[pool-1-thread-5,5,main] worker consume value: A20
Thread[pool-1-thread-5,5,main] worker consume value: A28
Thread[pool-1-thread-5,5,main] worker consume value: A27
Thread[pool-1-thread-5,5,main] worker consume value: A26
Thread[pool-1-thread-5,5,main] worker consume value: A25
Thread[pool-1-thread-5,5,main] worker consume value: A24
Thread[pool-1-thread-5,5,main] worker consume value: A23
Thread[pool-1-thread-5,5,main] worker consume value: A22
Thread[pool-1-thread-5,5,main] worker consume value: A21
Thread[pool-1-thread-2,5,main] produce value: A30
Thread[pool-1-thread-1,5,main] poll value: A30
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A31
Thread[pool-1-thread-1,5,main] poll value: A31
Thread[pool-1-thread-2,5,main] produce value: A32
Thread[pool-1-thread-1,5,main] poll value: A32
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A33
Thread[pool-1-thread-1,5,main] poll value: A33
Thread[pool-1-thread-2,5,main] produce value: A34
Thread[pool-1-thread-1,5,main] poll value: A34
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A35
Thread[pool-1-thread-1,5,main] poll value: A35
Thread[pool-1-thread-2,5,main] produce value: A36
Thread[pool-1-thread-1,5,main] poll value: A36
Thread[main,5,main] current size: 0
Thread[pool-1-thread-2,5,main] produce value: A37
Thread[pool-1-thread-1,5,main] poll value: A37
Thread[pool-1-thread-2,5,main] produce value: A38
Thread[pool-1-thread-1,5,main] poll value: A38
Thread[main,5,main] current size: 0

 

生产都消费者模式的一个demo,消费者设置缓存

标签:

原文地址:http://www.cnblogs.com/softidea/p/5176568.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!