org.springframework.core.NestedCheckedException Java Examples

The following examples show how to use org.springframework.core.NestedCheckedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractSockJsSession.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
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);
	}
}
 
Example #2
Source File: SampleMongoApplicationTests.java    From spring-boot-samples with Apache License 2.0 6 votes vote down vote up
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;
}