注意!!Redis使用不当真的可能会导致应用卡死
public T borrowObject(long borrowMaxWaitMillis) throws Exception {this.assertOpen();AbandonedConfig ac = this.abandonedConfig;if (ac != null && ac.getRemoveAbandonedOnBorrow() && this.getNumIdle() < 2 && this.getNumActive() > this.getMaxTotal() - 3) {this.removeAbandoned(ac);}PooledObject<T> p = null;boolean blockWhenExhausted = this.getBlockWhenExhausted();long waitTime = 0L;while(p == null) {boolean create = false;if (blockWhenExhausted) {p = (PooledObject)this.idleObjects.pollFirst();if (p == null) {create = true;p = this.create();}if (p == null) {if (borrowMaxWaitMillis < 0L) {p = (PooledObject)this.idleObjects.takeFirst();} else {waitTime = System.currentTimeMillis();p = (PooledObject)this.idleObjects.pollFirst(borrowMaxWaitMillis, TimeUnit.MILLISECONDS);waitTime = System.currentTimeMillis() - waitTime;}}if (p == null) {throw new NoSuchElementException("Timeout waiting for idle object");}