本文整理汇总了Java中com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException类的典型用法代码示例。如果您正苦于以下问题:Java MySQLNonTransientConnectionException类的具体用法?Java MySQLNonTransientConnectionException怎么用?Java MySQLNonTransientConnectionException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MySQLNonTransientConnectionException类属于com.mysql.jdbc.exceptions.jdbc4包,在下文中一共展示了MySQLNonTransientConnectionException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resetDatabaseTable
import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; //导入依赖的package包/类
public static void resetDatabaseTable(String tableName) throws Exception
{
try
{
doResetDatabaseTable(tableName);
}
catch (MySQLNonTransientConnectionException e) // Database probably doesn't exist, create it.
{
createDatabase();
}
doResetDatabaseTable(tableName);
}
示例2: isExceptionIndicativeOfOverload
import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; //导入依赖的package包/类
/**
* Indicates whether an exception is a symptom of MySQL being overloaded or slow.
* Typical symptoms are connection pool exhaustion or MySQL connection/socket timeouts.
*/
public static boolean isExceptionIndicativeOfOverload(Exception e) {
return e instanceof MySQLNonTransientConnectionException
|| e instanceof CommunicationsException
|| (e instanceof SQLNestedException
&& e.getCause() instanceof NoSuchElementException);
}
示例3: handleSQLConstraintException
import com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException; //导入依赖的package包/类
@ExceptionHandler(value = {SQLIntegrityConstraintViolationException.class, MySQLNonTransientConnectionException.class, DataIntegrityViolationException.class})
public ModelAndView handleSQLConstraintException(Exception ex) {
final ModelAndView mav = new ModelAndView("exception");
mav.addObject("message", MessageFactory.error("jpm.constraint.exception"));
JPMUtils.getLogger().fatal("Constraint Exception", ex);
return mav;
}