Polishing

This commit is contained in:
Juergen Hoeller 2014-08-11 15:20:09 +02:00
parent e2aba3d317
commit d6370965eb
2 changed files with 9 additions and 3 deletions

View File

@ -86,8 +86,8 @@ public class SpringSessionContext implements CurrentSessionContext {
else if (value instanceof SessionHolder) { else if (value instanceof SessionHolder) {
SessionHolder sessionHolder = (SessionHolder) value; SessionHolder sessionHolder = (SessionHolder) value;
Session session = sessionHolder.getSession(); Session session = sessionHolder.getSession();
if (TransactionSynchronizationManager.isSynchronizationActive() && if (!sessionHolder.isSynchronizedWithTransaction() &&
!sessionHolder.isSynchronizedWithTransaction()) { TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.registerSynchronization( TransactionSynchronizationManager.registerSynchronization(
new SpringSessionSynchronization(sessionHolder, this.sessionFactory, false)); new SpringSessionSynchronization(sessionHolder, this.sessionFactory, false));
sessionHolder.setSynchronizedWithTransaction(true); sessionHolder.setSynchronizedWithTransaction(true);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2014 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -1272,6 +1272,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
this.logger = LogFactory.getLog(getClass()); this.logger = LogFactory.getLog(getClass());
} }
/** /**
* Holder for suspended resources. * Holder for suspended resources.
* Used internally by {@code suspend} and {@code resume}. * Used internally by {@code suspend} and {@code resume}.
@ -1279,10 +1280,15 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
protected static class SuspendedResourcesHolder { protected static class SuspendedResourcesHolder {
private final Object suspendedResources; private final Object suspendedResources;
private List<TransactionSynchronization> suspendedSynchronizations; private List<TransactionSynchronization> suspendedSynchronizations;
private String name; private String name;
private boolean readOnly; private boolean readOnly;
private Integer isolationLevel; private Integer isolationLevel;
private boolean wasActive; private boolean wasActive;
private SuspendedResourcesHolder(Object suspendedResources) { private SuspendedResourcesHolder(Object suspendedResources) {