本文整理汇总了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();
}
示例2: stopNewConnectionsToHost
import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void stopNewConnectionsToHost(String group, String host)
throws SQLException {
ConnectionGroupManager.removeHost(group, host);
}
示例3: removeHost
import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void removeHost(String group, String host) throws SQLException {
ConnectionGroupManager.removeHost(group, host);
}
示例4: stopNewConnectionsToHost
import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void stopNewConnectionsToHost(String group, String host) throws SQLException {
ConnectionGroupManager.removeHost(group, host);
}
示例5: removeHost
import com.mysql.jdbc.ConnectionGroupManager; //导入方法依赖的package包/类
public void removeHost(String group, String host) throws SQLException {
ConnectionGroupManager.removeHost(group, host);
}