Java Code Examples for org.springframework.util.ErrorHandler#handleError()

The following examples show how to use org.springframework.util.ErrorHandler#handleError() . 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: SimpleApplicationEventMulticaster.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
/**
 * Invoke the given listener with the given event.
 * @param listener the ApplicationListener to invoke
 * @param event the current event to propagate
 * @since 4.1
 */
@SuppressWarnings({"unchecked", "rawtypes"})
protected void invokeListener(ApplicationListener listener, ApplicationEvent event) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		try {
			listener.onApplicationEvent(event);
		}
		catch (Throwable err) {
			errorHandler.handleError(err);
		}
	}
	else {
		listener.onApplicationEvent(event);
	}
}
 
Example 2
Source File: SimpleApplicationEventMulticaster.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Invoke the given listener with the given event.
 * @param listener the ApplicationListener to invoke
 * @param event the current event to propagate
 * @since 4.1
 */
protected void invokeListener(ApplicationListener<?> listener, ApplicationEvent event) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		try {
			doInvokeListener(listener, event);
		}
		catch (Throwable err) {
			errorHandler.handleError(err);
		}
	}
	else {
		doInvokeListener(listener, event);
	}
}
 
Example 3
Source File: AbstractMessageListenerContainer.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Invoke the registered ErrorHandler, if any. Log at warn level otherwise.
 * @param ex the uncaught error that arose during JMS processing.
 * @see #setErrorHandler
 */
protected void invokeErrorHandler(Throwable ex) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		errorHandler.handleError(ex);
	}
	else {
		logger.warn("Execution of JMS message listener failed, and no ErrorHandler has been set.", ex);
	}
}
 
Example 4
Source File: SimpleApplicationEventMulticaster.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Invoke the given listener with the given event.
 * @param listener the ApplicationListener to invoke
 * @param event the current event to propagate
 * @since 4.1
 */
protected void invokeListener(ApplicationListener<?> listener, ApplicationEvent event) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		try {
			doInvokeListener(listener, event);
		}
		catch (Throwable err) {
			errorHandler.handleError(err);
		}
	}
	else {
		doInvokeListener(listener, event);
	}
}
 
Example 5
Source File: AbstractMessageListenerContainer.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Invoke the registered ErrorHandler, if any. Log at warn level otherwise.
 * @param ex the uncaught error that arose during JMS processing.
 * @see #setErrorHandler
 */
protected void invokeErrorHandler(Throwable ex) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		errorHandler.handleError(ex);
	}
	else {
		logger.warn("Execution of JMS message listener failed, and no ErrorHandler has been set.", ex);
	}
}
 
Example 6
Source File: SimpleApplicationEventMulticaster.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Invoke the given listener with the given event.
 * @param listener the ApplicationListener to invoke
 * @param event the current event to propagate
 * @since 4.1
 */
protected void invokeListener(ApplicationListener<?> listener, ApplicationEvent event) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		try {
			doInvokeListener(listener, event);
		}
		catch (Throwable err) {
			errorHandler.handleError(err);
		}
	}
	else {
		doInvokeListener(listener, event);
	}
}
 
Example 7
Source File: AbstractMessageListenerContainer.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Invoke the registered ErrorHandler, if any. Log at warn level otherwise.
 * @param ex the uncaught error that arose during JMS processing.
 * @see #setErrorHandler
 */
protected void invokeErrorHandler(Throwable ex) {
	ErrorHandler errorHandler = getErrorHandler();
	if (errorHandler != null) {
		errorHandler.handleError(ex);
	}
	else {
		logger.warn("Execution of JMS message listener failed, and no ErrorHandler has been set.", ex);
	}
}