mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
fixed testcase
This commit is contained in:
@@ -22,7 +22,6 @@ import com.alibaba.druid.pool.vendor.MockExceptionSorter;
|
||||
import com.alibaba.druid.proxy.jdbc.StatementProxy;
|
||||
import com.alibaba.druid.support.logging.Log;
|
||||
import com.alibaba.druid.support.logging.Log4jImpl;
|
||||
import com.alibaba.druid.support.logging.LogFactory;
|
||||
import com.alibaba.druid.support.logging.NoLoggingImpl;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
@@ -47,8 +46,6 @@ public class AsyncCloseTest3 extends TestCase {
|
||||
|
||||
System.gc();
|
||||
|
||||
log4jLog = ((Log4jImpl) LogFactory.getLog(DruidDataSource.class)).getLog();
|
||||
|
||||
Field logField = DruidDataSource.class.getDeclaredField("LOG");
|
||||
logField.setAccessible(true);
|
||||
Log dataSourceLog = (Log) logField.get(null);
|
||||
|
||||
@@ -11,13 +11,13 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.util.JdbcUtils;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class Large10ConcurrentTest extends TestCase {
|
||||
|
||||
private DruidDataSource[] dataSources;
|
||||
@@ -29,15 +29,20 @@ public class Large10ConcurrentTest extends TestCase {
|
||||
long xmx = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() / (1000 * 1000); // m
|
||||
|
||||
final int dataSourceCount;
|
||||
if (xmx <= 500) {
|
||||
dataSourceCount = 500;
|
||||
} else if (xmx <= 1000) {
|
||||
dataSourceCount = 1000;
|
||||
|
||||
if (xmx <= 256) {
|
||||
dataSourceCount = 1024 * 1;
|
||||
} else if (xmx <= 512) {
|
||||
dataSourceCount = 1024 * 2;
|
||||
} else if (xmx <= 1024) {
|
||||
dataSourceCount = 1024 * 4;
|
||||
} else if (xmx <= 2048) {
|
||||
dataSourceCount = 1024 * 8;
|
||||
} else {
|
||||
dataSourceCount = 10000;
|
||||
dataSourceCount = 1024 * 16;
|
||||
}
|
||||
|
||||
dataSources = new DruidDataSource[10000];
|
||||
dataSources = new DruidDataSource[dataSourceCount];
|
||||
|
||||
executor = Executors.newFixedThreadPool(100);
|
||||
scheduler = Executors.newScheduledThreadPool(10);
|
||||
|
||||
@@ -20,13 +20,19 @@ public class Large10KTest extends TestCase {
|
||||
long xmx = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() / (1000 * 1000); // m
|
||||
|
||||
final int dataSourceCount;
|
||||
if (xmx <= 500) {
|
||||
dataSourceCount = 500;
|
||||
} else if (xmx <= 1000) {
|
||||
dataSourceCount = 1000;
|
||||
|
||||
if (xmx <= 256) {
|
||||
dataSourceCount = 1024 * 1;
|
||||
} else if (xmx <= 512) {
|
||||
dataSourceCount = 1024 * 2;
|
||||
} else if (xmx <= 1024) {
|
||||
dataSourceCount = 1024 * 4;
|
||||
} else if (xmx <= 2048) {
|
||||
dataSourceCount = 1024 * 8;
|
||||
} else {
|
||||
dataSourceCount = 10000;
|
||||
dataSourceCount = 1024 * 16;
|
||||
}
|
||||
|
||||
dataSources = new DruidDataSource[dataSourceCount];
|
||||
|
||||
scheduler = Executors.newScheduledThreadPool(10);
|
||||
|
||||
Reference in New Issue
Block a user