类org.springframework.core.NestedCheckedException源码实例Demo

下面列出了怎么用org.springframework.core.NestedCheckedException的API类实例代码及写法,或者点击链接到github查看源代码。

private void logWriteFrameFailure(Throwable failure) {
	@SuppressWarnings("serial")
	NestedCheckedException nestedException = new NestedCheckedException("", failure) {};

	if ("Broken pipe".equalsIgnoreCase(nestedException.getMostSpecificCause().getMessage()) ||
			disconnectedClientExceptions.contains(failure.getClass().getSimpleName())) {

		if (disconnectedClientLogger.isTraceEnabled()) {
			disconnectedClientLogger.trace("Looks like the client has gone away", failure);
		}
		else if (disconnectedClientLogger.isDebugEnabled()) {
			disconnectedClientLogger.debug("Looks like the client has gone away: " +
					nestedException.getMessage() + " (For full stack trace, set the '" +
					DISCONNECTED_CLIENT_LOG_CATEGORY + "' log category to TRACE level)");
		}
	}
	else {
		logger.debug("Terminating connection after failure to send message to client", failure);
	}
}
 
private boolean serverNotRunning(IllegalStateException ex) {
	@SuppressWarnings("serial")
	NestedCheckedException nested = new NestedCheckedException("failed", ex) {
	};
	Throwable root = nested.getRootCause();
	if (root instanceof MongoServerSelectionException
			|| root instanceof MongoTimeoutException) {
		if (root.getMessage().contains("Unable to connect to any server")) {
			return true;
		}
		if (TIMEOUT_MESSAGE_PATTERN.matcher(root.getMessage()).matches()) {
			return true;
		}
	}
	return false;
}
 
 类所在包
 类方法
 同包方法