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


Java ConnectionGroupManager.removeHost方法代码示例

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


在下文中一共展示了ConnectionGroupManager.removeHost方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: stopNewConnectionsToHost

import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void stopNewConnectionsToHost(String group, String host)
		throws SQLException {
	ConnectionGroupManager.removeHost(group, host);
	
}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:6,代码来源:LoadBalanceConnectionGroupManager.java

示例3: removeHost

import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void removeHost(String group, String host) throws SQLException {
    ConnectionGroupManager.removeHost(group, host);

}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:5,代码来源:LoadBalanceConnectionGroupManager.java

示例4: stopNewConnectionsToHost

import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void stopNewConnectionsToHost(String group, String host) throws SQLException {
    ConnectionGroupManager.removeHost(group, host);

}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:5,代码来源:LoadBalanceConnectionGroupManager.java

示例5: removeHost

import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void removeHost(String group, String host) throws SQLException {
	ConnectionGroupManager.removeHost(group, host);

}
 
开发者ID:hinsenchan,项目名称:fil_project_mgmt_app_v2,代码行数:5,代码来源:LoadBalanceConnectionGroupManager.java


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