本文整理汇总了Java中com.mysql.jdbc.SQLError.createLinkFailureMessageBasedOnHeuristics方法的典型用法代码示例。如果您正苦于以下问题:Java SQLError.createLinkFailureMessageBasedOnHeuristics方法的具体用法?Java SQLError.createLinkFailureMessageBasedOnHeuristics怎么用?Java SQLError.createLinkFailureMessageBasedOnHeuristics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.SQLError
的用法示例。
在下文中一共展示了SQLError.createLinkFailureMessageBasedOnHeuristics方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBug44587
import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
/**
* Tests fix for BUG#44587, provide last packet sent/received timing in all
* connection failure errors.
*/
public void testBug44587() throws Exception {
Exception e = null;
String msg = SQLError.createLinkFailureMessageBasedOnHeuristics((MySQLConnection) this.conn, System.currentTimeMillis() - 1000,
System.currentTimeMillis() - 2000, e);
assertTrue(containsMessage(msg, "CommunicationsException.ServerPacketTimingInfo"));
}
示例2: testBug45419
import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
/**
* Tests fix for BUG#45419, ensure that time is not converted to seconds
* before being reported as milliseconds.
*/
public void testBug45419() throws Exception {
Exception e = null;
String msg = SQLError.createLinkFailureMessageBasedOnHeuristics((MySQLConnection) this.conn, System.currentTimeMillis() - 1000,
System.currentTimeMillis() - 2000, e);
Matcher m = Pattern.compile("([\\d\\,\\.]+)", Pattern.MULTILINE).matcher(msg);
assertTrue(m.find());
assertTrue(Long.parseLong(m.group(0).replaceAll("[,.]", "")) >= 2000);
assertTrue(Long.parseLong(m.group(1).replaceAll("[,.]", "")) >= 1000);
}
示例3: CommunicationsException
import com.mysql.jdbc.SQLError; //导入方法依赖的package包/类
public CommunicationsException(MySQLConnection conn, long lastPacketSentTimeMs, long lastPacketReceivedTimeMs, Exception underlyingException) {
this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn, lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException);
if (underlyingException != null) {
initCause(underlyingException);
}
}