remove ha

This commit is contained in:
wenshao
2012-11-26 19:51:26 +08:00
parent c0308e1a30
commit d18f32dd12
30 changed files with 0 additions and 4057 deletions
@@ -1,69 +0,0 @@
/*
* Copyright 1999-2011 Alibaba Group Holding Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.alibaba.druid.pool.ha;
import java.sql.Connection;
import java.sql.Statement;
import java.util.concurrent.CountDownLatch;
import junit.framework.TestCase;
import com.alibaba.druid.pool.ha.cobar.CobarDataSource;
public class CobarDataSourceTest extends TestCase {
public void test_cobar() throws Exception {
String url = "jdbc:cobar://10.20.165.79:8080/druid";
final CobarDataSource dataSource = new CobarDataSource();
dataSource.setUrl(url);
dataSource.setUsername("test");
dataSource.setPassword("");
final int COUNT = 10;
final CountDownLatch latch = new CountDownLatch(COUNT);
Runnable task = new Runnable() {
public void run() {
try {
for (int i = 0; i < 1000 * 1000; ++i) {
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
stmt.execute("select 1");
stmt.close();
conn.close();
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
latch.countDown();
}
}
};
for (int i = 0; i < 10; ++i) {
Thread thread = new Thread(task);
thread.setName("thread-" + i);
thread.start();
}
latch.await();
}
}