首页 > 代码库 > DefaultTransactionStatus源码
DefaultTransactionStatus源码
package org.springframework.transaction.support; import org.springframework.transaction.NestedTransactionNotSupportedException; import org.springframework.transaction.SavepointManager; public class DefaultTransactionStatus extends AbstractTransactionStatus { private final Object transaction; private final boolean newTransaction; private final boolean newSynchronization; private final boolean readOnly; private final boolean debug; private final Object suspendedResources; public DefaultTransactionStatus(Object transaction, boolean newTransaction,
boolean newSynchronization, boolean readOnly, boolean debug, Object suspendedResources) { this.transaction = transaction; this.newTransaction = newTransaction; this.newSynchronization = newSynchronization; this.readOnly = readOnly; this.debug = debug; this.suspendedResources = suspendedResources; } public Object getTransaction() { return this.transaction; } public boolean hasTransaction() { return this.transaction != null; } public boolean isNewTransaction() { return (hasTransaction()) && (this.newTransaction); } public boolean isNewSynchronization() { return this.newSynchronization; } public boolean isReadOnly() { return this.readOnly; } public boolean isDebug() { return this.debug; } public Object getSuspendedResources() { return this.suspendedResources; } public boolean isGlobalRollbackOnly() { return ((this.transaction instanceof SmartTransactionObject)) && (((SmartTransactionObject)this.transaction).isRollbackOnly()); } protected SavepointManager getSavepointManager() { if (!isTransactionSavepointManager()) { throw new NestedTransactionNotSupportedException("Transaction object [" + getTransaction() + "] does not support savepoints"); } return (SavepointManager)getTransaction(); } public boolean isTransactionSavepointManager() { return getTransaction() instanceof SavepointManager; } }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。