polishing

This commit is contained in:
Juergen Hoeller 2009-05-08 23:16:53 +00:00
parent d34c4a2cf0
commit d34953e933
3 changed files with 21 additions and 29 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2005 the original author or authors. * Copyright 2002-2009 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.
@ -19,15 +19,13 @@ package org.springframework.transaction.annotation;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
/** /**
* Enumeration that represents transaction isolation levels * Enumeration that represents transaction isolation levels for use
* for use with the JDK 1.5+ transaction annotation, corresponding * with the {@link Transactional} annotation, corresponding to the
* to the TransactionDefinition interface. * {@link TransactionDefinition} interface.
* *
* @author Colin Sampaleanu * @author Colin Sampaleanu
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 1.2 * @since 1.2
* @see org.springframework.transaction.annotation.Transactional
* @see org.springframework.transaction.TransactionDefinition
*/ */
public enum Isolation { public enum Isolation {
@ -85,6 +83,6 @@ public enum Isolation {
Isolation(int value) { this.value = value; } Isolation(int value) { this.value = value; }
public int value() { return value; } public int value() { return this.value; }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2005 the original author or authors. * Copyright 2002-2009 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.
@ -19,15 +19,13 @@ package org.springframework.transaction.annotation;
import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionDefinition;
/** /**
* Enumeration that represents transaction propagation behaviors * Enumeration that represents transaction propagation behaviors for use
* for use with the JDK 1.5+ transaction annotation, corresponding * with the {@link Transactional} annotation, corresponding to the
* to the TransactionDefinition interface. * {@link TransactionDefinition} interface.
* *
* @author Colin Sampaleanu * @author Colin Sampaleanu
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 1.2 * @since 1.2
* @see org.springframework.transaction.annotation.Transactional
* @see org.springframework.transaction.TransactionDefinition
*/ */
public enum Propagation { public enum Propagation {
@ -43,7 +41,7 @@ public enum Propagation {
* Analogous to EJB transaction attribute of the same name. * Analogous to EJB transaction attribute of the same name.
* <p>Note: For transaction managers with transaction synchronization, * <p>Note: For transaction managers with transaction synchronization,
* PROPAGATION_SUPPORTS is slightly different from no transaction at all, * PROPAGATION_SUPPORTS is slightly different from no transaction at all,
* as it defines a transaction scopp that synchronization will apply for. * as it defines a transaction scope that synchronization will apply for.
* As a consequence, the same resources (JDBC Connection, Hibernate Session, etc) * As a consequence, the same resources (JDBC Connection, Hibernate Session, etc)
* will be shared for the entire specified scope. Note that this depends on * will be shared for the entire specified scope. Note that this depends on
* the actual synchronization configuration of the transaction manager. * the actual synchronization configuration of the transaction manager.
@ -102,6 +100,6 @@ public enum Propagation {
Propagation(int value) { this.value = value; } Propagation(int value) { this.value = value; }
public int value() { return value; } public int value() { return this.value; }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2008 the original author or authors. * Copyright 2002-2009 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.
@ -38,8 +38,7 @@ import org.springframework.transaction.UnexpectedRollbackException;
/** /**
* Abstract base class that implements Spring's standard transaction workflow, * Abstract base class that implements Spring's standard transaction workflow,
* serving as basis for concrete platform transaction managers like * serving as basis for concrete platform transaction managers like
* {@link org.springframework.transaction.jta.JtaTransactionManager} and * {@link org.springframework.transaction.jta.JtaTransactionManager}.
* {@link org.springframework.jdbc.datasource.DataSourceTransactionManager}.
* *
* <p>This base class provides the following workflow handling: * <p>This base class provides the following workflow handling:
* <ul> * <ul>
@ -78,8 +77,6 @@ import org.springframework.transaction.UnexpectedRollbackException;
* @see #setTransactionSynchronization * @see #setTransactionSynchronization
* @see TransactionSynchronizationManager * @see TransactionSynchronizationManager
* @see org.springframework.transaction.jta.JtaTransactionManager * @see org.springframework.transaction.jta.JtaTransactionManager
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager
* @see org.springframework.orm.hibernate3.HibernateTransactionManager
*/ */
public abstract class AbstractPlatformTransactionManager implements PlatformTransactionManager, Serializable { public abstract class AbstractPlatformTransactionManager implements PlatformTransactionManager, Serializable {
@ -260,7 +257,6 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* only work when nested transaction support is available. This is the case * only work when nested transaction support is available. This is the case
* with DataSourceTransactionManager, but not with JtaTransactionManager. * with DataSourceTransactionManager, but not with JtaTransactionManager.
* @see #setNestedTransactionAllowed * @see #setNestedTransactionAllowed
* @see org.springframework.jdbc.datasource.DataSourceTransactionManager
* @see org.springframework.transaction.jta.JtaTransactionManager * @see org.springframework.transaction.jta.JtaTransactionManager
*/ */
public final void setGlobalRollbackOnParticipationFailure(boolean globalRollbackOnParticipationFailure) { public final void setGlobalRollbackOnParticipationFailure(boolean globalRollbackOnParticipationFailure) {
@ -543,7 +539,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
*/ */
protected final SuspendedResourcesHolder suspend(Object transaction) throws TransactionException { protected final SuspendedResourcesHolder suspend(Object transaction) throws TransactionException {
if (TransactionSynchronizationManager.isSynchronizationActive()) { if (TransactionSynchronizationManager.isSynchronizationActive()) {
List suspendedSynchronizations = doSuspendSynchronization(); List<TransactionSynchronization> suspendedSynchronizations = doSuspendSynchronization();
try { try {
Object suspendedResources = null; Object suspendedResources = null;
if (transaction != null) { if (transaction != null) {
@ -600,7 +596,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
if (suspendedResources != null) { if (suspendedResources != null) {
doResume(transaction, suspendedResources); doResume(transaction, suspendedResources);
} }
List suspendedSynchronizations = resourcesHolder.suspendedSynchronizations; List<TransactionSynchronization> suspendedSynchronizations = resourcesHolder.suspendedSynchronizations;
if (suspendedSynchronizations != null) { if (suspendedSynchronizations != null) {
TransactionSynchronizationManager.setActualTransactionActive(resourcesHolder.wasActive); TransactionSynchronizationManager.setActualTransactionActive(resourcesHolder.wasActive);
TransactionSynchronizationManager.setCurrentTransactionIsolationLevel(resourcesHolder.isolationLevel); TransactionSynchronizationManager.setCurrentTransactionIsolationLevel(resourcesHolder.isolationLevel);
@ -938,7 +934,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
*/ */
private void triggerAfterCompletion(DefaultTransactionStatus status, int completionStatus) { private void triggerAfterCompletion(DefaultTransactionStatus status, int completionStatus) {
if (status.isNewSynchronization()) { if (status.isNewSynchronization()) {
List synchronizations = TransactionSynchronizationManager.getSynchronizations(); List<TransactionSynchronization> synchronizations = TransactionSynchronizationManager.getSynchronizations();
if (!status.hasTransaction() || status.isNewTransaction()) { if (!status.hasTransaction() || status.isNewTransaction()) {
if (status.isDebug()) { if (status.isDebug()) {
logger.trace("Triggering afterCompletion synchronization"); logger.trace("Triggering afterCompletion synchronization");
@ -969,7 +965,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see TransactionSynchronization#STATUS_ROLLED_BACK * @see TransactionSynchronization#STATUS_ROLLED_BACK
* @see TransactionSynchronization#STATUS_UNKNOWN * @see TransactionSynchronization#STATUS_UNKNOWN
*/ */
protected final void invokeAfterCompletion(List synchronizations, int completionStatus) { protected final void invokeAfterCompletion(List<TransactionSynchronization> synchronizations, int completionStatus) {
TransactionSynchronizationUtils.invokeAfterCompletion(synchronizations, completionStatus); TransactionSynchronizationUtils.invokeAfterCompletion(synchronizations, completionStatus);
} }
@ -1217,8 +1213,8 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
* @see TransactionSynchronization#afterCompletion(int) * @see TransactionSynchronization#afterCompletion(int)
* @see TransactionSynchronization#STATUS_UNKNOWN * @see TransactionSynchronization#STATUS_UNKNOWN
*/ */
protected void registerAfterCompletionWithExistingTransaction(Object transaction, List synchronizations) protected void registerAfterCompletionWithExistingTransaction(
throws TransactionException { Object transaction, List<TransactionSynchronization> synchronizations) throws TransactionException {
logger.debug("Cannot register Spring after-completion synchronization with existing transaction - " + logger.debug("Cannot register Spring after-completion synchronization with existing transaction - " +
"processing Spring after-completion callbacks immediately, with outcome status 'unknown'"); "processing Spring after-completion callbacks immediately, with outcome status 'unknown'");
@ -1256,7 +1252,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
protected static class SuspendedResourcesHolder { protected static class SuspendedResourcesHolder {
private final Object suspendedResources; private final Object suspendedResources;
private List suspendedSynchronizations; private List<TransactionSynchronization> suspendedSynchronizations;
private String name; private String name;
private boolean readOnly; private boolean readOnly;
private Integer isolationLevel; private Integer isolationLevel;
@ -1267,7 +1263,7 @@ public abstract class AbstractPlatformTransactionManager implements PlatformTran
} }
private SuspendedResourcesHolder( private SuspendedResourcesHolder(
Object suspendedResources, List suspendedSynchronizations, Object suspendedResources, List<TransactionSynchronization> suspendedSynchronizations,
String name, boolean readOnly, Integer isolationLevel, boolean wasActive) { String name, boolean readOnly, Integer isolationLevel, boolean wasActive) {
this.suspendedResources = suspendedResources; this.suspendedResources = suspendedResources;
this.suspendedSynchronizations = suspendedSynchronizations; this.suspendedSynchronizations = suspendedSynchronizations;