当前位置: 首页>>代码示例>>Java>>正文


Java ConnectionGroupManager类代码示例

本文整理汇总了Java中com.mysql.jdbc.ConnectionGroupManager的典型用法代码示例。如果您正苦于以下问题:Java ConnectionGroupManager类的具体用法?Java ConnectionGroupManager怎么用?Java ConnectionGroupManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConnectionGroupManager类属于com.mysql.jdbc包,在下文中一共展示了ConnectionGroupManager类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBug22730682

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
/**
 * Tests fix for Bug#22730682 - ARRAYINDEXOUTOFBOUNDSEXCEPTION FROM CONNECTIONGROUPMANAGER.REMOVEHOST().
 * 
 * This bug was caused by an incorrect array handling when removing an host from a load balanced connection group, with the option to affect existing
 * connections.
 */
public void testBug22730682() throws Exception {
    Properties connProps = getPropertiesFromTestsuiteUrl();
    String host = connProps.getProperty(NonRegisteringDriver.HOST_PROPERTY_KEY, "localhost");
    String port = connProps.getProperty(NonRegisteringDriver.PORT_PROPERTY_KEY, "3306");

    final String currentHost = host + ":" + port;
    final String dummyHost = "bug22730682:12345";

    final Properties props = new Properties();
    Connection testConn;

    final String lbConnGroup1 = "Bug22730682LB1";
    props.setProperty("loadBalanceConnectionGroup", lbConnGroup1);
    testConn = getLoadBalancedConnection(3, dummyHost, props);
    assertEquals(2, ConnectionGroupManager.getActiveHostCount(lbConnGroup1));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup1).contains(dummyHost));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup1).contains(currentHost));
    ConnectionGroupManager.removeHost(lbConnGroup1, dummyHost);
    assertEquals(1, ConnectionGroupManager.getActiveHostCount(lbConnGroup1));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup1).contains(currentHost));
    testConn.close();

    final String lbConnGroup2 = "Bug22730682LB2";
    props.setProperty("loadBalanceConnectionGroup", lbConnGroup2);
    testConn = getLoadBalancedConnection(3, dummyHost, props);
    assertEquals(2, ConnectionGroupManager.getActiveHostCount(lbConnGroup2));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup2).contains(dummyHost));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup2).contains(currentHost));
    ConnectionGroupManager.removeHost(lbConnGroup2, dummyHost, true);
    assertEquals(1, ConnectionGroupManager.getActiveHostCount(lbConnGroup2));
    assertTrue(ConnectionGroupManager.getActiveHostLists(lbConnGroup2).contains(currentHost));
    testConn.close();
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:40,代码来源:ConnectionRegressionTest.java

示例2: addHost

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public void addHost(String group, String host, boolean forExisting) {
    try {
        ConnectionGroupManager.addHost(group, host, forExisting);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:8,代码来源:LoadBalanceConnectionGroupManager.java

示例3: addHost

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public void addHost(String group, String host, boolean forExisting) {
	try {
	ConnectionGroupManager.addHost(group, host, forExisting);
	} catch (Exception e){
		e.printStackTrace();
	}
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:8,代码来源:LoadBalanceConnectionGroupManager.java

示例4: getActiveHostCount

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public int getActiveHostCount(String group) {
    return ConnectionGroupManager.getActiveHostCount(group);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:LoadBalanceConnectionGroupManager.java

示例5: getActiveLogicalConnectionCount

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public long getActiveLogicalConnectionCount(String group) {
    return ConnectionGroupManager.getActiveLogicalConnectionCount(group);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:LoadBalanceConnectionGroupManager.java

示例6: getActivePhysicalConnectionCount

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public long getActivePhysicalConnectionCount(String group) {
    return ConnectionGroupManager.getActivePhysicalConnectionCount(group);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:LoadBalanceConnectionGroupManager.java

示例7: getActiveHostsList

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public String getActiveHostsList(String group) {
    return ConnectionGroupManager.getActiveHostLists(group);
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:LoadBalanceConnectionGroupManager.java

示例8: getRegisteredConnectionGroups

import com.mysql.jdbc.ConnectionGroupManager; //导入依赖的package包/类
public String getRegisteredConnectionGroups() {
    return ConnectionGroupManager.getRegisteredConnectionGroups();
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:4,代码来源:LoadBalanceConnectionGroupManager.java


注:本文中的com.mysql.jdbc.ConnectionGroupManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。