
top.jfunc.common.thread.conpro.QueueHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of common-utils Show documentation
Show all versions of common-utils Show documentation
common utils like IOUtil,StrUtil,HoldProcessor.etc.
The newest version!
package top.jfunc.common.thread.conpro;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.BlockingQueue;
/**
* @author xiongshiyan
* 通用的阻塞队列保持者,通过名字保存和获取
*/
public class QueueHolder {
private static Map blockingQueueMap = new HashMap<>();
public static void put(String pipelineName , BlockingQueue blockingQueue){
blockingQueueMap.put(pipelineName , blockingQueue);
}
public static BlockingQueue getBlockingQueue(String pipelineName) {
if(null == pipelineName || "".equals(pipelineName)){
throw new IllegalArgumentException(" pipelineName 不能为空 ");
}
BlockingQueue blockingQueue = blockingQueueMap.get(pipelineName);
if(null == blockingQueue){
throw new IllegalStateException(pipelineName + " 对应的队列不存在 ...");
}
return blockingQueue;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy