mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
补充监控信息 & 重构
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@261 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.alibaba.druid;
|
||||
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import com.alibaba.druid.util.LinkedTransferQueue;
|
||||
@@ -7,6 +10,10 @@ import com.alibaba.druid.util.LinkedTransferQueue;
|
||||
public class TestLinkedTransferQueue extends TestCase {
|
||||
|
||||
public void test_0() throws Exception {
|
||||
final Lock lock = new ReentrantLock();
|
||||
|
||||
lock.lock();
|
||||
|
||||
final LinkedTransferQueue<Object> q = new LinkedTransferQueue<Object>();
|
||||
|
||||
Thread takeThread = new Thread("Take Thread") {
|
||||
@@ -24,6 +31,11 @@ public class TestLinkedTransferQueue extends TestCase {
|
||||
takeThread.start();
|
||||
|
||||
// q.take();
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
Object value = i;
|
||||
q.transfer(value);
|
||||
}
|
||||
|
||||
q.put(1);
|
||||
q.put(2);
|
||||
System.out.println(q.size());
|
||||
|
||||
@@ -45,9 +45,9 @@ public class Case1 extends TestCase {
|
||||
private int maxPoolSize = 50;
|
||||
private int maxActive = 50;
|
||||
private String validationQuery = "SELECT 1";
|
||||
private int threadCount = 10;
|
||||
private int threadCount = 40;
|
||||
private int loopCount = 4;
|
||||
final int LOOP_COUNT = 1000 * 100;
|
||||
final int LOOP_COUNT = 1000 * 10;
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
jdbcUrl = "jdbc:fake:dragoon_v25masterdb";
|
||||
@@ -78,7 +78,7 @@ public class Case1 extends TestCase {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public void test_1() throws Exception {
|
||||
public void ftest_1() throws Exception {
|
||||
final BasicDataSource dataSource = new BasicDataSource();
|
||||
|
||||
dataSource.setInitialSize(initialSize);
|
||||
|
||||
Reference in New Issue
Block a user