Added @Override annotations to transaction module

This commit is contained in:
Arjen Poutsma 2008-10-27 23:52:03 +00:00
parent 77ad22e338
commit aa60746155
38 changed files with 94 additions and 0 deletions

View File

@ -119,6 +119,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
return getConnectionFactory(); return getConnectionFactory();
} }
@Override
protected Object doGetTransaction() { protected Object doGetTransaction() {
CciLocalTransactionObject txObject = new CciLocalTransactionObject(); CciLocalTransactionObject txObject = new CciLocalTransactionObject();
ConnectionHolder conHolder = ConnectionHolder conHolder =
@ -127,12 +128,14 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
return txObject; return txObject;
} }
@Override
protected boolean isExistingTransaction(Object transaction) { protected boolean isExistingTransaction(Object transaction) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction; CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction;
// Consider a pre-bound connection as transaction. // Consider a pre-bound connection as transaction.
return (txObject.getConnectionHolder() != null); return (txObject.getConnectionHolder() != null);
} }
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) { protected void doBegin(Object transaction, TransactionDefinition definition) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction; CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction;
@ -169,12 +172,14 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
} }
} }
@Override
protected Object doSuspend(Object transaction) { protected Object doSuspend(Object transaction) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction; CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction;
txObject.setConnectionHolder(null); txObject.setConnectionHolder(null);
return TransactionSynchronizationManager.unbindResource(getConnectionFactory()); return TransactionSynchronizationManager.unbindResource(getConnectionFactory());
} }
@Override
protected void doResume(Object transaction, Object suspendedResources) { protected void doResume(Object transaction, Object suspendedResources) {
ConnectionHolder conHolder = (ConnectionHolder) suspendedResources; ConnectionHolder conHolder = (ConnectionHolder) suspendedResources;
TransactionSynchronizationManager.bindResource(getConnectionFactory(), conHolder); TransactionSynchronizationManager.bindResource(getConnectionFactory(), conHolder);
@ -185,6 +190,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
return txObject.getConnectionHolder().isRollbackOnly(); return txObject.getConnectionHolder().isRollbackOnly();
} }
@Override
protected void doCommit(DefaultTransactionStatus status) { protected void doCommit(DefaultTransactionStatus status) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction(); CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
Connection con = txObject.getConnectionHolder().getConnection(); Connection con = txObject.getConnectionHolder().getConnection();
@ -202,6 +208,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
} }
} }
@Override
protected void doRollback(DefaultTransactionStatus status) { protected void doRollback(DefaultTransactionStatus status) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction(); CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
Connection con = txObject.getConnectionHolder().getConnection(); Connection con = txObject.getConnectionHolder().getConnection();
@ -219,6 +226,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
} }
} }
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) { protected void doSetRollbackOnly(DefaultTransactionStatus status) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction(); CciLocalTransactionObject txObject = (CciLocalTransactionObject) status.getTransaction();
if (status.isDebug()) { if (status.isDebug()) {
@ -228,6 +236,7 @@ public class CciLocalTransactionManager extends AbstractPlatformTransactionManag
txObject.getConnectionHolder().setRollbackOnly(); txObject.getConnectionHolder().setRollbackOnly();
} }
@Override
protected void doCleanupAfterCompletion(Object transaction) { protected void doCleanupAfterCompletion(Object transaction) {
CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction; CciLocalTransactionObject txObject = (CciLocalTransactionObject) transaction;

View File

@ -205,6 +205,7 @@ public abstract class ConnectionFactoryUtils {
super(connectionHolder, connectionFactory); super(connectionHolder, connectionFactory);
} }
@Override
protected void releaseResource(ResourceHolder resourceHolder, Object resourceKey) { protected void releaseResource(ResourceHolder resourceHolder, Object resourceKey) {
releaseConnection(((ConnectionHolder) resourceHolder).getConnection(), (ConnectionFactory) resourceKey); releaseConnection(((ConnectionHolder) resourceHolder).getConnection(), (ConnectionFactory) resourceKey);
} }

View File

@ -105,6 +105,7 @@ public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnection
* "connectionSpec" property else. * "connectionSpec" property else.
* @see #doGetConnection * @see #doGetConnection
*/ */
@Override
public final Connection getConnection() throws ResourceException { public final Connection getConnection() throws ResourceException {
ConnectionSpec threadSpec = (ConnectionSpec) this.threadBoundSpec.get(); ConnectionSpec threadSpec = (ConnectionSpec) this.threadBoundSpec.get();
if (threadSpec != null) { if (threadSpec != null) {

View File

@ -98,6 +98,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
/** /**
* Make sure a Connection or ConnectionFactory has been set. * Make sure a Connection or ConnectionFactory has been set.
*/ */
@Override
public void afterPropertiesSet() { public void afterPropertiesSet() {
if (this.connection == null && getTargetConnectionFactory() == null) { if (this.connection == null && getTargetConnectionFactory() == null) {
throw new IllegalArgumentException("Connection or 'targetConnectionFactory' is required"); throw new IllegalArgumentException("Connection or 'targetConnectionFactory' is required");
@ -105,6 +106,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
} }
@Override
public Connection getConnection() throws ResourceException { public Connection getConnection() throws ResourceException {
synchronized (this.connectionMonitor) { synchronized (this.connectionMonitor) {
if (this.connection == null) { if (this.connection == null) {
@ -114,6 +116,7 @@ public class SingleConnectionFactory extends DelegatingConnectionFactory impleme
} }
} }
@Override
public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException { public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException {
throw new NotSupportedException( throw new NotSupportedException(
"SingleConnectionFactory does not support custom ConnectionSpec"); "SingleConnectionFactory does not support custom ConnectionSpec");

View File

@ -89,6 +89,7 @@ public class TransactionAwareConnectionFactoryProxy extends DelegatingConnection
* @return a transactional Connection if any, a new one else * @return a transactional Connection if any, a new one else
* @see org.springframework.jca.cci.connection.ConnectionFactoryUtils#doGetConnection * @see org.springframework.jca.cci.connection.ConnectionFactoryUtils#doGetConnection
*/ */
@Override
public Connection getConnection() throws ResourceException { public Connection getConnection() throws ResourceException {
Connection con = ConnectionFactoryUtils.doGetConnection(getTargetConnectionFactory()); Connection con = ConnectionFactoryUtils.doGetConnection(getTargetConnectionFactory());
return getTransactionAwareConnectionProxy(con, getTargetConnectionFactory()); return getTransactionAwareConnectionProxy(con, getTargetConnectionFactory());

View File

@ -93,6 +93,7 @@ public abstract class CciDaoSupport extends DaoSupport {
return this.cciTemplate; return this.cciTemplate;
} }
@Override
protected final void checkDaoConfig() { protected final void checkDaoConfig() {
if (this.cciTemplate == null) { if (this.cciTemplate == null) {
throw new IllegalArgumentException("'connectionFactory' or 'cciTemplate' is required"); throw new IllegalArgumentException("'connectionFactory' or 'cciTemplate' is required");

View File

@ -89,6 +89,7 @@ public class CommAreaRecord implements Record, Streamable {
} }
@Override
public Object clone() { public Object clone() {
return new CommAreaRecord(this.bytes); return new CommAreaRecord(this.bytes);
} }

View File

@ -54,6 +54,7 @@ public abstract class MappingCommAreaOperation extends MappingRecordOperation {
} }
@Override
protected final Record createInputRecord(RecordFactory recordFactory, Object inObject) { protected final Record createInputRecord(RecordFactory recordFactory, Object inObject) {
try { try {
return new CommAreaRecord(objectToBytes(inObject)); return new CommAreaRecord(objectToBytes(inObject));
@ -63,6 +64,7 @@ public abstract class MappingCommAreaOperation extends MappingRecordOperation {
} }
} }
@Override
protected final Object extractOutputData(Record record) throws DataAccessException { protected final Object extractOutputData(Record record) throws DataAccessException {
CommAreaRecord commAreaRecord = (CommAreaRecord) record; CommAreaRecord commAreaRecord = (CommAreaRecord) record;
try { try {

View File

@ -52,6 +52,7 @@ public class ResourceAdapterApplicationContext extends GenericApplicationContext
} }
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
beanFactory.addBeanPostProcessor(new BootstrapContextAwareProcessor(this.bootstrapContext)); beanFactory.addBeanPostProcessor(new BootstrapContextAwareProcessor(this.bootstrapContext));
beanFactory.ignoreDependencyInterface(BootstrapContextAware.class); beanFactory.ignoreDependencyInterface(BootstrapContextAware.class);

View File

@ -69,6 +69,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
* exposing the message listener's interfaces as well as the * exposing the message listener's interfaces as well as the
* endpoint SPI through an AOP introduction. * endpoint SPI through an AOP introduction.
*/ */
@Override
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException { public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException {
GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource); GenericMessageEndpoint endpoint = (GenericMessageEndpoint) super.createEndpoint(xaResource);
ProxyFactory proxyFactory = new ProxyFactory(this.messageListener); ProxyFactory proxyFactory = new ProxyFactory(this.messageListener);
@ -81,6 +82,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
/** /**
* Creates a concrete generic message endpoint, internal to this factory. * Creates a concrete generic message endpoint, internal to this factory.
*/ */
@Override
protected AbstractMessageEndpoint createEndpointInternal() throws UnavailableException { protected AbstractMessageEndpoint createEndpointInternal() throws UnavailableException {
return new GenericMessageEndpoint(); return new GenericMessageEndpoint();
} }
@ -131,6 +133,7 @@ public class GenericMessageEndpointFactory extends AbstractMessageEndpointFactor
} }
} }
@Override
protected ClassLoader getEndpointClassLoader() { protected ClassLoader getEndpointClassLoader() {
return messageListener.getClass().getClassLoader(); return messageListener.getClass().getClassLoader();
} }

View File

@ -73,6 +73,7 @@ public class GlassFishWorkManagerTaskExecutor extends WorkManagerTaskExecutor {
/** /**
* Obtains GlassFish's default thread pool. * Obtains GlassFish's default thread pool.
*/ */
@Override
protected WorkManager getDefaultWorkManager() { protected WorkManager getDefaultWorkManager() {
return (WorkManager) ReflectionUtils.invokeMethod(this.getWorkManagerMethod, null, new Object[] {null}); return (WorkManager) ReflectionUtils.invokeMethod(this.getWorkManagerMethod, null, new Object[] {null});
} }

View File

@ -40,6 +40,7 @@ public class JBossWorkManagerTaskExecutor extends WorkManagerTaskExecutor {
* for the JBossWorkManagerMBean. * for the JBossWorkManagerMBean.
* @see JBossWorkManagerUtils#getWorkManager() * @see JBossWorkManagerUtils#getWorkManager()
*/ */
@Override
protected WorkManager getDefaultWorkManager() { protected WorkManager getDefaultWorkManager() {
return JBossWorkManagerUtils.getWorkManager(); return JBossWorkManagerUtils.getWorkManager();
} }

View File

@ -81,6 +81,7 @@ public class TransactionSystemException extends TransactionException {
return (this.applicationException != null ? this.applicationException : getCause()); return (this.applicationException != null ? this.applicationException : getCause());
} }
@Override
public boolean contains(Class exType) { public boolean contains(Class exType) {
return super.contains(exType) || (exType != null && exType.isInstance(this.applicationException)); return super.contains(exType) || (exType != null && exType.isInstance(this.applicationException));
} }

View File

@ -112,10 +112,12 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
} }
@Override
protected TransactionAttribute findTransactionAttribute(Method method) { protected TransactionAttribute findTransactionAttribute(Method method) {
return determineTransactionAttribute(method); return determineTransactionAttribute(method);
} }
@Override
protected TransactionAttribute findTransactionAttribute(Class clazz) { protected TransactionAttribute findTransactionAttribute(Class clazz) {
return determineTransactionAttribute(clazz); return determineTransactionAttribute(clazz);
} }
@ -144,15 +146,18 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
/** /**
* By default, only public methods can be made transactional. * By default, only public methods can be made transactional.
*/ */
@Override
protected boolean allowPublicMethodsOnly() { protected boolean allowPublicMethodsOnly() {
return this.publicMethodsOnly; return this.publicMethodsOnly;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (this == other || other instanceof AnnotationTransactionAttributeSource); return (this == other || other instanceof AnnotationTransactionAttributeSource);
} }
@Override
public int hashCode() { public int hashCode() {
return AnnotationTransactionAttributeSource.class.hashCode(); return AnnotationTransactionAttributeSource.class.hashCode();
} }

View File

@ -59,6 +59,7 @@ public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBea
"oracle.j2ee.transaction.OC4JTransactionManager", JtaTransactionManagerBeanDefinitionParser.class.getClassLoader()); "oracle.j2ee.transaction.OC4JTransactionManager", JtaTransactionManagerBeanDefinitionParser.class.getClassLoader());
@Override
protected String getBeanClassName(Element element) { protected String getBeanClassName(Element element) {
if (weblogicPresent) { if (weblogicPresent) {
return WEBLOGIC_JTA_TRANSACTION_MANAGER_CLASS_NAME; return WEBLOGIC_JTA_TRANSACTION_MANAGER_CLASS_NAME;
@ -74,6 +75,7 @@ public class JtaTransactionManagerBeanDefinitionParser extends AbstractSingleBea
} }
} }
@Override
protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) { protected String resolveId(Element element, AbstractBeanDefinition definition, ParserContext parserContext) {
return DEFAULT_TRANSACTION_MANAGER_BEAN_NAME; return DEFAULT_TRANSACTION_MANAGER_BEAN_NAME;
} }

View File

@ -63,10 +63,12 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
private static final String NO_ROLLBACK_FOR = "no-rollback-for"; private static final String NO_ROLLBACK_FOR = "no-rollback-for";
@Override
protected Class getBeanClass(Element element) { protected Class getBeanClass(Element element) {
return TransactionInterceptor.class; return TransactionInterceptor.class;
} }
@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
// Set the transaction manager property. // Set the transaction manager property.
String transactionManagerName = (element.hasAttribute(TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE) ? String transactionManagerName = (element.hasAttribute(TxNamespaceUtils.TRANSACTION_MANAGER_ATTRIBUTE) ?

View File

@ -210,6 +210,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
this.targetClass = targetClass; this.targetClass = targetClass;
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -222,6 +223,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
ObjectUtils.nullSafeEquals(this.targetClass, otherKey.targetClass)); ObjectUtils.nullSafeEquals(this.targetClass, otherKey.targetClass));
} }
@Override
public int hashCode() { public int hashCode() {
return this.method.hashCode() * 29 + (this.targetClass != null ? this.targetClass.hashCode() : 0); return this.method.hashCode() * 29 + (this.targetClass != null ? this.targetClass.hashCode() : 0);
} }

View File

@ -35,6 +35,7 @@ public class BeanFactoryTransactionAttributeSourceAdvisor extends AbstractBeanFa
private TransactionAttributeSource transactionAttributeSource; private TransactionAttributeSource transactionAttributeSource;
private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() { private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() {
@Override
protected TransactionAttributeSource getTransactionAttributeSource() { protected TransactionAttributeSource getTransactionAttributeSource() {
return transactionAttributeSource; return transactionAttributeSource;
} }

View File

@ -69,14 +69,17 @@ public abstract class DelegatingTransactionAttribute implements TransactionAttri
} }
@Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return this.targetAttribute.equals(obj); return this.targetAttribute.equals(obj);
} }
@Override
public int hashCode() { public int hashCode() {
return this.targetAttribute.hashCode(); return this.targetAttribute.hashCode();
} }
@Override
public String toString() { public String toString() {
return this.targetAttribute.toString(); return this.targetAttribute.toString();
} }

View File

@ -54,6 +54,7 @@ public class MatchAlwaysTransactionAttributeSource implements TransactionAttribu
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -65,10 +66,12 @@ public class MatchAlwaysTransactionAttributeSource implements TransactionAttribu
return ObjectUtils.nullSafeEquals(this.transactionAttribute, otherTas.transactionAttribute); return ObjectUtils.nullSafeEquals(this.transactionAttribute, otherTas.transactionAttribute);
} }
@Override
public int hashCode() { public int hashCode() {
return MatchAlwaysTransactionAttributeSource.class.hashCode(); return MatchAlwaysTransactionAttributeSource.class.hashCode();
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": " + this.transactionAttribute; return getClass().getName() + ": " + this.transactionAttribute;
} }

View File

@ -247,6 +247,7 @@ public class MethodMapTransactionAttributeSource
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -258,10 +259,12 @@ public class MethodMapTransactionAttributeSource
return ObjectUtils.nullSafeEquals(this.methodMap, otherTas.methodMap); return ObjectUtils.nullSafeEquals(this.methodMap, otherTas.methodMap);
} }
@Override
public int hashCode() { public int hashCode() {
return MethodMapTransactionAttributeSource.class.hashCode(); return MethodMapTransactionAttributeSource.class.hashCode();
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": " + this.methodMap; return getClass().getName() + ": " + this.methodMap;
} }

View File

@ -146,6 +146,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -157,10 +158,12 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
return ObjectUtils.nullSafeEquals(this.nameMap, otherTas.nameMap); return ObjectUtils.nullSafeEquals(this.nameMap, otherTas.nameMap);
} }
@Override
public int hashCode() { public int hashCode() {
return NameMatchTransactionAttributeSource.class.hashCode(); return NameMatchTransactionAttributeSource.class.hashCode();
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": " + this.nameMap; return getClass().getName() + ": " + this.nameMap;
} }

View File

@ -45,6 +45,7 @@ public class NoRollbackRuleAttribute extends RollbackRuleAttribute {
super(exceptionName); super(exceptionName);
} }
@Override
public String toString() { public String toString() {
return "No" + super.toString(); return "No" + super.toString();
} }

View File

@ -122,6 +122,7 @@ public class RollbackRuleAttribute implements Serializable{
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -133,10 +134,12 @@ public class RollbackRuleAttribute implements Serializable{
return this.exceptionName.equals(rhs.exceptionName); return this.exceptionName.equals(rhs.exceptionName);
} }
@Override
public int hashCode() { public int hashCode() {
return this.exceptionName.hashCode(); return this.exceptionName.hashCode();
} }
@Override
public String toString() { public String toString() {
return "RollbackRuleAttribute with pattern [" + this.exceptionName + "]"; return "RollbackRuleAttribute with pattern [" + this.exceptionName + "]";
} }

View File

@ -125,6 +125,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
* return false. * return false.
* @see TransactionAttribute#rollbackOn(java.lang.Throwable) * @see TransactionAttribute#rollbackOn(java.lang.Throwable)
*/ */
@Override
public boolean rollbackOn(Throwable ex) { public boolean rollbackOn(Throwable ex) {
if (logger.isTraceEnabled()) { if (logger.isTraceEnabled()) {
logger.trace("Applying rules to determine whether transaction should rollback on " + ex); logger.trace("Applying rules to determine whether transaction should rollback on " + ex);
@ -158,6 +159,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
} }
@Override
public String toString() { public String toString() {
StringBuffer result = getDefinitionDescription(); StringBuffer result = getDefinitionDescription();
if (this.rollbackRules != null) { if (this.rollbackRules != null) {

View File

@ -250,6 +250,7 @@ public abstract class TransactionAspectSupport implements InitializingBean {
// If no name specified, apply method identification as transaction name. // If no name specified, apply method identification as transaction name.
if (txAttr != null && txAttr.getName() == null) { if (txAttr != null && txAttr.getName() == null) {
txAttr = new DelegatingTransactionAttribute(txAttr) { txAttr = new DelegatingTransactionAttribute(txAttr) {
@Override
public String getName() { public String getName() {
return joinpointIdentification; return joinpointIdentification;
} }
@ -447,6 +448,7 @@ public abstract class TransactionAspectSupport implements InitializingBean {
transactionInfoHolder.set(this.oldTransactionInfo); transactionInfoHolder.set(this.oldTransactionInfo);
} }
@Override
public String toString() { public String toString() {
return this.transactionAttribute.toString(); return this.transactionAttribute.toString();
} }

View File

@ -47,6 +47,7 @@ public class TransactionAttributeEditor extends PropertyEditorSupport {
* Null or the empty string means that the method is non transactional. * Null or the empty string means that the method is non transactional.
* @see java.beans.PropertyEditor#setAsText(java.lang.String) * @see java.beans.PropertyEditor#setAsText(java.lang.String)
*/ */
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
if (StringUtils.hasLength(text)) { if (StringUtils.hasLength(text)) {
// tokenize it with "," // tokenize it with ","

View File

@ -40,6 +40,7 @@ public class TransactionAttributeSourceAdvisor extends AbstractPointcutAdvisor {
private TransactionInterceptor transactionInterceptor; private TransactionInterceptor transactionInterceptor;
private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() { private final TransactionAttributeSourcePointcut pointcut = new TransactionAttributeSourcePointcut() {
@Override
protected TransactionAttributeSource getTransactionAttributeSource() { protected TransactionAttributeSource getTransactionAttributeSource() {
return (transactionInterceptor != null ? transactionInterceptor.getTransactionAttributeSource() : null); return (transactionInterceptor != null ? transactionInterceptor.getTransactionAttributeSource() : null);
} }

View File

@ -48,6 +48,7 @@ import org.springframework.util.StringUtils;
*/ */
public class TransactionAttributeSourceEditor extends PropertyEditorSupport { public class TransactionAttributeSourceEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException { public void setAsText(String text) throws IllegalArgumentException {
MethodMapTransactionAttributeSource source = new MethodMapTransactionAttributeSource(); MethodMapTransactionAttributeSource source = new MethodMapTransactionAttributeSource();
if (StringUtils.hasLength(text)) { if (StringUtils.hasLength(text)) {

View File

@ -36,6 +36,7 @@ abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPoi
return (tas == null || tas.getTransactionAttribute(method, targetClass) != null); return (tas == null || tas.getTransactionAttribute(method, targetClass) != null);
} }
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
if (this == other) { if (this == other) {
return true; return true;
@ -47,10 +48,12 @@ abstract class TransactionAttributeSourcePointcut extends StaticMethodMatcherPoi
return ObjectUtils.nullSafeEquals(getTransactionAttributeSource(), otherPc.getTransactionAttributeSource()); return ObjectUtils.nullSafeEquals(getTransactionAttributeSource(), otherPc.getTransactionAttributeSource());
} }
@Override
public int hashCode() { public int hashCode() {
return TransactionAttributeSourcePointcut.class.hashCode(); return TransactionAttributeSourcePointcut.class.hashCode();
} }
@Override
public String toString() { public String toString() {
return getClass().getName() + ": " + getTransactionAttributeSource(); return getClass().getName() + ": " + getTransactionAttributeSource();
} }

View File

@ -216,6 +216,7 @@ public class TransactionInterceptor extends TransactionAspectSupport implements
super(throwable); super(throwable);
} }
@Override
public String toString() { public String toString() {
return getCause().toString(); return getCause().toString();
} }

View File

@ -184,6 +184,7 @@ public class TransactionProxyFactoryBean extends AbstractSingletonProxyFactoryBe
/** /**
* Creates an advisor for this FactoryBean's TransactionInterceptor. * Creates an advisor for this FactoryBean's TransactionInterceptor.
*/ */
@Override
protected Object createMainInterceptor() { protected Object createMainInterceptor() {
this.transactionInterceptor.afterPropertiesSet(); this.transactionInterceptor.afterPropertiesSet();
if (this.pointcut != null) { if (this.pointcut != null) {

View File

@ -790,6 +790,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
* flag to enforce a fresh lookup for every transaction. * flag to enforce a fresh lookup for every transaction.
* @see #setCacheUserTransaction * @see #setCacheUserTransaction
*/ */
@Override
protected Object doGetTransaction() { protected Object doGetTransaction() {
UserTransaction ut = getUserTransaction(); UserTransaction ut = getUserTransaction();
if (ut == null) { if (ut == null) {
@ -814,6 +815,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
return new JtaTransactionObject(ut); return new JtaTransactionObject(ut);
} }
@Override
protected boolean isExistingTransaction(Object transaction) { protected boolean isExistingTransaction(Object transaction) {
JtaTransactionObject txObject = (JtaTransactionObject) transaction; JtaTransactionObject txObject = (JtaTransactionObject) transaction;
try { try {
@ -832,11 +834,13 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
* @see #doBegin * @see #doBegin
* @see javax.transaction.UserTransaction#begin() * @see javax.transaction.UserTransaction#begin()
*/ */
@Override
protected boolean useSavepointForNestedTransaction() { protected boolean useSavepointForNestedTransaction() {
return false; return false;
} }
@Override
protected void doBegin(Object transaction, TransactionDefinition definition) { protected void doBegin(Object transaction, TransactionDefinition definition) {
JtaTransactionObject txObject = (JtaTransactionObject) transaction; JtaTransactionObject txObject = (JtaTransactionObject) transaction;
try { try {
@ -927,6 +931,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
} }
@Override
protected Object doSuspend(Object transaction) { protected Object doSuspend(Object transaction) {
JtaTransactionObject txObject = (JtaTransactionObject) transaction; JtaTransactionObject txObject = (JtaTransactionObject) transaction;
try { try {
@ -955,6 +960,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
return getTransactionManager().suspend(); return getTransactionManager().suspend();
} }
@Override
protected void doResume(Object transaction, Object suspendedResources) { protected void doResume(Object transaction, Object suspendedResources) {
JtaTransactionObject txObject = (JtaTransactionObject) transaction; JtaTransactionObject txObject = (JtaTransactionObject) transaction;
try { try {
@ -997,10 +1003,12 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
* This implementation returns "true": a JTA commit will properly handle * This implementation returns "true": a JTA commit will properly handle
* transactions that have been marked rollback-only at a global level. * transactions that have been marked rollback-only at a global level.
*/ */
@Override
protected boolean shouldCommitOnGlobalRollbackOnly() { protected boolean shouldCommitOnGlobalRollbackOnly() {
return true; return true;
} }
@Override
protected void doCommit(DefaultTransactionStatus status) { protected void doCommit(DefaultTransactionStatus status) {
JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction(); JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction();
try { try {
@ -1045,6 +1053,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
} }
} }
@Override
protected void doRollback(DefaultTransactionStatus status) { protected void doRollback(DefaultTransactionStatus status) {
JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction(); JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction();
try { try {
@ -1071,6 +1080,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
} }
} }
@Override
protected void doSetRollbackOnly(DefaultTransactionStatus status) { protected void doSetRollbackOnly(DefaultTransactionStatus status) {
JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction(); JtaTransactionObject txObject = (JtaTransactionObject) status.getTransaction();
if (status.isDebug()) { if (status.isDebug()) {
@ -1091,6 +1101,7 @@ public class JtaTransactionManager extends AbstractPlatformTransactionManager
} }
@Override
protected void registerAfterCompletionWithExistingTransaction(Object transaction, List synchronizations) { protected void registerAfterCompletionWithExistingTransaction(Object transaction, List synchronizations) {
JtaTransactionObject txObject = (JtaTransactionObject) transaction; JtaTransactionObject txObject = (JtaTransactionObject) transaction;
logger.debug("Registering after-completion synchronization with existing JTA transaction"); logger.debug("Registering after-completion synchronization with existing JTA transaction");

View File

@ -89,11 +89,13 @@ public class OC4JJtaTransactionManager extends JtaTransactionManager {
private Method setTransactionIsolationMethod; private Method setTransactionIsolationMethod;
@Override
public void afterPropertiesSet() throws TransactionSystemException { public void afterPropertiesSet() throws TransactionSystemException {
super.afterPropertiesSet(); super.afterPropertiesSet();
loadOC4JTransactionClasses(); loadOC4JTransactionClasses();
} }
@Override
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException { protected UserTransaction retrieveUserTransaction() throws TransactionSystemException {
try { try {
Class transactionUtilityClass = getClass().getClassLoader().loadClass(TRANSACTION_UTILITY_CLASS_NAME); Class transactionUtilityClass = getClass().getClassLoader().loadClass(TRANSACTION_UTILITY_CLASS_NAME);
@ -153,6 +155,7 @@ public class OC4JJtaTransactionManager extends JtaTransactionManager {
} }
@Override
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition)
throws NotSupportedException, SystemException { throws NotSupportedException, SystemException {
@ -211,6 +214,7 @@ public class OC4JJtaTransactionManager extends JtaTransactionManager {
} }
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException { public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
if (this.beginWithNameMethod != null && name != null) { if (this.beginWithNameMethod != null && name != null) {
UserTransaction ut = getUserTransaction(); UserTransaction ut = getUserTransaction();

View File

@ -105,11 +105,13 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
private Object transactionHelper; private Object transactionHelper;
@Override
public void afterPropertiesSet() throws TransactionSystemException { public void afterPropertiesSet() throws TransactionSystemException {
super.afterPropertiesSet(); super.afterPropertiesSet();
loadWebLogicTransactionClasses(); loadWebLogicTransactionClasses();
} }
@Override
protected UserTransaction retrieveUserTransaction() throws TransactionSystemException { protected UserTransaction retrieveUserTransaction() throws TransactionSystemException {
loadWebLogicTransactionHelperClass(); loadWebLogicTransactionHelperClass();
try { try {
@ -128,6 +130,7 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
} }
} }
@Override
protected TransactionManager retrieveTransactionManager() throws TransactionSystemException { protected TransactionManager retrieveTransactionManager() throws TransactionSystemException {
loadWebLogicTransactionHelperClass(); loadWebLogicTransactionHelperClass();
try { try {
@ -229,6 +232,7 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
} }
@Override
protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition) protected void doJtaBegin(JtaTransactionObject txObject, TransactionDefinition definition)
throws NotSupportedException, SystemException { throws NotSupportedException, SystemException {
@ -297,6 +301,7 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
} }
} }
@Override
protected void doJtaResume(JtaTransactionObject txObject, Object suspendedTransaction) protected void doJtaResume(JtaTransactionObject txObject, Object suspendedTransaction)
throws InvalidTransactionException, SystemException { throws InvalidTransactionException, SystemException {
@ -332,6 +337,7 @@ public class WebLogicJtaTransactionManager extends JtaTransactionManager {
} }
@Override
public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException { public Transaction createTransaction(String name, int timeout) throws NotSupportedException, SystemException {
if (this.weblogicUserTransactionAvailable && name != null) { if (this.weblogicUserTransactionAvailable && name != null) {
try { try {

View File

@ -136,6 +136,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
} }
@Override
public void afterPropertiesSet() throws TransactionSystemException { public void afterPropertiesSet() throws TransactionSystemException {
initUserTransactionAndTransactionManager(); initUserTransactionAndTransactionManager();
@ -176,6 +177,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
/** /**
* Registers the synchronizations as interposed JTA Synchronization on the UOWManager. * Registers the synchronizations as interposed JTA Synchronization on the UOWManager.
*/ */
@Override
protected void doRegisterAfterCompletionWithJtaTransaction(JtaTransactionObject txObject, List synchronizations) { protected void doRegisterAfterCompletionWithJtaTransaction(JtaTransactionObject txObject, List synchronizations) {
this.uowManager.registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations)); this.uowManager.registerInterposedSynchronization(new JtaAfterCompletionSynchronization(synchronizations));
} }

View File

@ -217,6 +217,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
* This implementation compares the <code>toString()</code> results. * This implementation compares the <code>toString()</code> results.
* @see #toString() * @see #toString()
*/ */
@Override
public boolean equals(Object other) { public boolean equals(Object other) {
return (other instanceof TransactionDefinition && toString().equals(other.toString())); return (other instanceof TransactionDefinition && toString().equals(other.toString()));
} }
@ -225,6 +226,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
* This implementation returns <code>toString()</code>'s hash code. * This implementation returns <code>toString()</code>'s hash code.
* @see #toString() * @see #toString()
*/ */
@Override
public int hashCode() { public int hashCode() {
return toString().hashCode(); return toString().hashCode();
} }
@ -241,6 +243,7 @@ public class DefaultTransactionDefinition implements TransactionDefinition, Seri
* @see #getDefinitionDescription() * @see #getDefinitionDescription()
* @see org.springframework.transaction.interceptor.TransactionAttributeEditor * @see org.springframework.transaction.interceptor.TransactionAttributeEditor
*/ */
@Override
public String toString() { public String toString() {
return getDefinitionDescription().toString(); return getDefinitionDescription().toString();
} }

View File

@ -150,6 +150,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
* by the transaction coordinator, for example in case of a timeout. * by the transaction coordinator, for example in case of a timeout.
* @see SmartTransactionObject#isRollbackOnly * @see SmartTransactionObject#isRollbackOnly
*/ */
@Override
public boolean isGlobalRollbackOnly() { public boolean isGlobalRollbackOnly() {
return ((this.transaction instanceof SmartTransactionObject) && return ((this.transaction instanceof SmartTransactionObject) &&
((SmartTransactionObject) this.transaction).isRollbackOnly()); ((SmartTransactionObject) this.transaction).isRollbackOnly());
@ -159,6 +160,7 @@ public class DefaultTransactionStatus extends AbstractTransactionStatus {
* This implementation exposes the SavepointManager interface * This implementation exposes the SavepointManager interface
* of the underlying transaction object, if any. * of the underlying transaction object, if any.
*/ */
@Override
protected SavepointManager getSavepointManager() { protected SavepointManager getSavepointManager() {
if (!isTransactionSavepointManager()) { if (!isTransactionSavepointManager()) {
throw new NestedTransactionNotSupportedException( throw new NestedTransactionNotSupportedException(