Exception for OSIV deferred close with async requests
OSIV deferred close mode is not supported with async requests and is unlikely to be what's the desired. This change adds an exception with a message stating this. Issue: SPR-8517
This commit is contained in:
parent
158b3c6af8
commit
6cca57afd3
|
@ -218,6 +218,9 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter {
|
|||
closeSession(sessionHolder.getSession(), sessionFactory);
|
||||
}
|
||||
else {
|
||||
if (chain.isAsyncStarted()) {
|
||||
throw new IllegalStateException("Deferred close is not supported with async requests.");
|
||||
}
|
||||
// deferred close mode
|
||||
SessionFactoryUtils.processDeferredClose(sessionFactory);
|
||||
}
|
||||
|
|
|
@ -193,8 +193,13 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A
|
|||
*/
|
||||
public void postHandleAsyncStarted(WebRequest request) {
|
||||
String attributeName = getParticipateAttributeName();
|
||||
if ((request.getAttribute(attributeName, WebRequest.SCOPE_REQUEST) == null) && isSingleSession()) {
|
||||
TransactionSynchronizationManager.unbindResource(getSessionFactory());
|
||||
if (request.getAttribute(attributeName, WebRequest.SCOPE_REQUEST) == null) {
|
||||
if (isSingleSession()) {
|
||||
TransactionSynchronizationManager.unbindResource(getSessionFactory());
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Deferred close is not supported with async requests.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue