Merge pull request #50 from wenshao/master

修正不能够Graceshutdown的问题
This commit is contained in:
温高铁
2012-08-24 21:20:41 -07:00
2 changed files with 12 additions and 1 deletions
@@ -955,6 +955,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
notEmptyWaitThreadCount--;
}
notEmptyWaitCount++;
if (!enable) {
connectErrorCount.incrementAndGet();
throw new DataSourceDisableException();
}
}
} catch (InterruptedException ie) {
notEmpty.signal(); // propagate to non-interrupted thread
@@ -993,6 +998,11 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
// creator
notEmptyWaitCount++;
notEmptyWaitNanos += (startEstimate - estimate);
if (!enable) {
connectErrorCount.incrementAndGet();
throw new DataSourceDisableException();
}
} catch (InterruptedException ie) {
notEmpty.signal(); // propagate to non-interrupted thread
notEmptySignalCount++;
@@ -17,6 +17,7 @@ package com.alibaba.druid.bvt.pool;
import java.sql.Connection;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import junit.framework.Assert;
import junit.framework.TestCase;
@@ -91,6 +92,6 @@ public class TestGraceShutdown extends TestCase {
}
}.start();
endLatch.await();
Assert.assertTrue(endLatch.await(60, TimeUnit.SECONDS));
}
}