本文共 939 字,大约阅读时间需要 3 分钟。
- public class ConcurrentSupport {
-
- private ConcurrentQueue queue;
-
- private ConcurrentQueueService queueService;
-
- public ConcurrentSupport(){
- queue = new ConcurrentQueue();
- queueService = new ConcurrentQueueService(queue);
- }
-
- public ConcurrentSupport(int queueSize){
- queue = new ConcurrentQueue(queueSize);
- queueService = new ConcurrentQueueService(queue);
- }
-
-
- public ConcurrentSupport(int queueSize,String name){
- queue = new ConcurrentQueue(queueSize,name);
- queueService = new ConcurrentQueueService(queue);
- }
-
-
- public boolean process(IConcurrentCall target) {
- queueService.enQueue(target);
- return true;
- }
- }
把队,与队的服务作成一个操作类,便于使用。
转载地址:http://ucnmd.baihongyu.com/