com.alogic.pool.impl.Queued Maven / Gradle / Ivy
package com.alogic.pool.impl;
import java.util.Map;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Element;
import com.anysoft.util.IOTools;
import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;
import com.anysoft.util.XmlElementProperties;
import com.alogic.pool.Pool;
import com.alogic.pool.CloseAware;
/**
* 基于队列的缓冲池实现
*
*
* @author duanyy
* @version 1.6.7.9 [20170201 duanyy]
* - 采用SLF4j日志框架输出日志
*
*/
public abstract class Queued implements Pool,CloseAware {
/**
* a logger of log4j
*/
protected Logger logger = LoggerFactory.getLogger(Queued.class);
/**
* 正在工作的对象个数
*/
private volatile int workingCnt = 0;
/**
* 空闲的对象个数
*/
private volatile int idleCnt = 0;
/**
* 等待的进程个数
*/
private volatile int waitCnt = 0;
/**
* 正在创建对象的进程个数
*/
private volatile int creatingCnt = 0;
/**
* 空闲队列
*/
private ConcurrentLinkedQueue