stack.push(new TransactionData(TransactionType.INDEPENDENT));
}
else if (type == TransactionType.INDEPENDENT) {
// We're trying to create an independent transaction in a thread that is already participating
// in a transaction. This is illegal in Forte, so raise an exception
UsageException ue = new UsageException("An INDEPENDENT transaction may not be nested");
ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
throw ue;
}
else {
// We need to add a new item to the stack. If the outer transaction has been started, we just
// inherit it's data source. Otherwise, we defer the commencement of the transaction until
// we actually use the data source
TransactionData lastItem = stack.peek();
if (lastItem.getType() == TransactionType.NESTED && type == TransactionType.DEPENDENT) {
// We're trying to create an dependent transaction in a thread that is already participating
// in a nested transaction. This is illegal in Forte, so raise an exception
UsageException ue = new UsageException("A DEPENDENT transaction may not be started from a NESTED transaction");
ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
throw ue;
}
else if (lastItem.getType() == TransactionType.DEPENDENT && type == TransactionType.NESTED) {
// We're trying to create a nested transaction in a thread that is already participating
// in a dependent transaction. This is illegal in Forte, so raise an exception
UsageException ue = new UsageException("A NESTED transaction may not be started from a DEPENDENT transaction");
ue.reasonCode = Constants.SP_ER_INVALIDSTATE;
throw ue;
}
TransactionData data;
if (lastItem.dataSource != null) {