Method from org.apache.openejb.ri.sp.PseudoTransactionService Detail: |
public void begin() throws NotSupportedException {
if (threadTransaction.get() != null) {
throw new NotSupportedException("A transaction is already active");
}
MyTransaction tx = new MyTransaction();
threadTransaction.set(tx);
}
|
public void commit() throws RollbackException {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
try {
tx.commit();
} finally {
threadTransaction.set(null);
}
}
|
public Object getResource(Object key) {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
Object value = tx.getResource(key);
return value;
}
|
public boolean getRollbackOnly() {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
return tx.getRollbackOnly();
}
|
public int getStatus() {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
return Status.STATUS_NO_TRANSACTION;
}
return tx.getStatus();
}
|
public Transaction getTransaction() {
return threadTransaction.get();
}
|
public Object getTransactionKey() {
return getTransaction();
}
|
public TransactionManager getTransactionManager() {
return this;
}
|
public int getTransactionStatus() {
return getStatus();
}
|
public TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
return this;
}
|
public void init(Properties props) {
}
|
public void putResource(Object key,
Object value) {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
tx.putResource(key, value);
}
|
public void registerInterposedSynchronization(Synchronization synchronization) {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
tx.registerInterposedSynchronization(synchronization);
}
|
public void resume(Transaction tx) throws InvalidTransactionException {
if (tx == null) {
throw new InvalidTransactionException("Transaction is null");
}
if (!(tx instanceof MyTransaction)) {
throw new InvalidTransactionException("Unknown transaction type " + tx.getClass().getName());
}
MyTransaction myTransaction = (MyTransaction) tx;
if (threadTransaction.get() != null) {
throw new IllegalStateException("A transaction is already active");
}
int status = myTransaction.getStatus();
if (status != Status.STATUS_ACTIVE && status != Status.STATUS_MARKED_ROLLBACK) {
throw new InvalidTransactionException("Expected transaction to be STATUS_ACTIVE or STATUS_MARKED_ROLLBACK, but was " + status);
}
threadTransaction.set(myTransaction);
}
|
public void rollback() {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
try {
tx.rollback();
} finally {
threadTransaction.set(null);
}
}
|
public void setRollbackOnly() {
MyTransaction tx = threadTransaction.get();
if (tx == null) {
throw new IllegalStateException("No transaction active");
}
tx.setRollbackOnly();
}
|
public void setTransactionTimeout(int seconds) {
}
|
public Transaction suspend() {
return threadTransaction.get();
}
|