Consistent non-public AsyncRequestInterceptor classes
Issue: SPR-11694
This commit is contained in:
		
							parent
							
								
									f9c3910341
								
							
						
					
					
						commit
						cf0a916793
					
				| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2014 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -16,7 +16,6 @@
 | 
			
		|||
 | 
			
		||||
package org.springframework.orm.hibernate4.support;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.Callable;
 | 
			
		||||
 | 
			
		||||
import org.apache.commons.logging.Log;
 | 
			
		||||
| 
						 | 
				
			
			@ -42,8 +41,7 @@ import org.springframework.web.context.request.async.DeferredResultProcessingInt
 | 
			
		|||
 * @author Rossen Stoyanchev
 | 
			
		||||
 * @since 3.2.5
 | 
			
		||||
 */
 | 
			
		||||
public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
 | 
			
		||||
		implements DeferredResultProcessingInterceptor {
 | 
			
		||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
 | 
			
		||||
 | 
			
		||||
	private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -89,19 +87,22 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
 | 
			
		|||
	private void closeAfterTimeout() {
 | 
			
		||||
		if (this.timeoutInProgress) {
 | 
			
		||||
			logger.debug("Closing Hibernate Session after async request timeout");
 | 
			
		||||
			SessionFactoryUtils.closeSession(sessionHolder.getSession());
 | 
			
		||||
			SessionFactoryUtils.closeSession(this.sessionHolder.getSession());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// Implementation of DeferredResultProcessingInterceptor methods
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2013 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -41,8 +41,7 @@ import org.springframework.web.context.request.async.DeferredResultProcessingInt
 | 
			
		|||
 * @author Rossen Stoyanchev
 | 
			
		||||
 * @since 3.2.5
 | 
			
		||||
 */
 | 
			
		||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
 | 
			
		||||
		implements DeferredResultProcessingInterceptor {
 | 
			
		||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
 | 
			
		||||
 | 
			
		||||
	private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,6 +57,7 @@ class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
 | 
			
		|||
		this.sessionHolder = sessionHolder;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void preProcess(NativeWebRequest request, Callable<T> task) {
 | 
			
		||||
		bindSession();
 | 
			
		||||
| 
						 | 
				
			
			@ -87,15 +87,24 @@ class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
 | 
			
		|||
	private void closeAfterTimeout() {
 | 
			
		||||
		if (this.timeoutInProgress) {
 | 
			
		||||
			logger.debug("Closing Hibernate Session after async request timeout");
 | 
			
		||||
			SessionFactoryUtils.closeSession(sessionHolder.getSession());
 | 
			
		||||
			SessionFactoryUtils.closeSession(this.sessionHolder.getSession());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	// Implementation of DeferredResultProcessingInterceptor methods
 | 
			
		||||
 | 
			
		||||
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {}
 | 
			
		||||
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {}
 | 
			
		||||
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {}
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2014 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -16,7 +16,6 @@
 | 
			
		|||
 | 
			
		||||
package org.springframework.orm.jpa.support;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
import java.util.concurrent.Callable;
 | 
			
		||||
import javax.persistence.EntityManagerFactory;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,8 +41,7 @@ import org.springframework.web.context.request.async.DeferredResultProcessingInt
 | 
			
		|||
 * @author Rossen Stoyanchev
 | 
			
		||||
 * @since 3.2.5
 | 
			
		||||
 */
 | 
			
		||||
public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter
 | 
			
		||||
		implements DeferredResultProcessingInterceptor {
 | 
			
		||||
class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapter implements DeferredResultProcessingInterceptor {
 | 
			
		||||
 | 
			
		||||
	private static final Log logger = LogFactory.getLog(AsyncRequestInterceptor.class);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -96,12 +94,15 @@ public class AsyncRequestInterceptor extends CallableProcessingInterceptorAdapte
 | 
			
		|||
 | 
			
		||||
	// Implementation of DeferredResultProcessingInterceptor methods
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,5 @@
 | 
			
		|||
/*
 | 
			
		||||
 * Copyright 2002-2012 the original author or authors.
 | 
			
		||||
 * Copyright 2002-2015 the original author or authors.
 | 
			
		||||
 *
 | 
			
		||||
 * Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
 * you may not use this file except in compliance with the License.
 | 
			
		||||
| 
						 | 
				
			
			@ -13,6 +13,7 @@
 | 
			
		|||
 * See the License for the specific language governing permissions and
 | 
			
		||||
 * limitations under the License.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
package org.springframework.web.context.request.async;
 | 
			
		||||
 | 
			
		||||
import org.springframework.web.context.request.NativeWebRequest;
 | 
			
		||||
| 
						 | 
				
			
			@ -45,7 +46,6 @@ public interface DeferredResultProcessingInterceptor {
 | 
			
		|||
	 * Invoked immediately before the start of concurrent handling, in the same
 | 
			
		||||
	 * thread that started it. This method may be used to capture state just prior
 | 
			
		||||
	 * to the start of concurrent processing with the given {@code DeferredResult}.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request the current request
 | 
			
		||||
	 * @param deferredResult the DeferredResult for the current request
 | 
			
		||||
	 * @throws Exception in case of errors
 | 
			
		||||
| 
						 | 
				
			
			@ -56,10 +56,8 @@ public interface DeferredResultProcessingInterceptor {
 | 
			
		|||
	 * Invoked immediately after the start of concurrent handling, in the same
 | 
			
		||||
	 * thread that started it. This method may be used to detect the start of
 | 
			
		||||
	 * concurrent processing with the given {@code DeferredResult}.
 | 
			
		||||
	 *
 | 
			
		||||
	 * <p>The {@code DeferredResult} may have already been set, for example at
 | 
			
		||||
	 * the time of its creation or by another thread.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request the current request
 | 
			
		||||
	 * @param deferredResult the DeferredResult for the current request
 | 
			
		||||
	 * @throws Exception in case of errors
 | 
			
		||||
| 
						 | 
				
			
			@ -71,11 +69,9 @@ public interface DeferredResultProcessingInterceptor {
 | 
			
		|||
	 * {@link DeferredResult#setResult(Object)} or
 | 
			
		||||
	 * {@link DeferredResult#setErrorResult(Object)}, and is also ready to
 | 
			
		||||
	 * handle the concurrent result.
 | 
			
		||||
	 *
 | 
			
		||||
	 * <p>This method may also be invoked after a timeout when the
 | 
			
		||||
	 * {@code DeferredResult} was created with a constructor accepting a default
 | 
			
		||||
	 * timeout result.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request the current request
 | 
			
		||||
	 * @param deferredResult the DeferredResult for the current request
 | 
			
		||||
	 * @param concurrentResult the result to which the {@code DeferredResult}
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +84,6 @@ public interface DeferredResultProcessingInterceptor {
 | 
			
		|||
	 * the {@code DeferredResult} has been set. Implementations may invoke
 | 
			
		||||
	 * {@link DeferredResult#setResult(Object) setResult} or
 | 
			
		||||
	 * {@link DeferredResult#setErrorResult(Object) setErrorResult} to resume processing.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request the current request
 | 
			
		||||
	 * @param deferredResult the DeferredResult for the current request; if the
 | 
			
		||||
	 * {@code DeferredResult} is set, then concurrent processing is resumed and
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +98,6 @@ public interface DeferredResultProcessingInterceptor {
 | 
			
		|||
	 * Invoked from a container thread when an async request completed for any
 | 
			
		||||
	 * reason including timeout and network error. This method is useful for
 | 
			
		||||
	 * detecting that a {@code DeferredResult} instance is no longer usable.
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param request the current request
 | 
			
		||||
	 * @param deferredResult the DeferredResult for the current request
 | 
			
		||||
	 * @throws Exception in case of errors
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue