Search in sources :

Example 1 with NotSubtransaction

use of org.omg.CosTransactions.NotSubtransaction in project narayana by jbosstm.

the class ArjunaTransactionImple method register_subtran_aware.

/**
 * Do not propagate the resource to the parent.
 */
public void register_subtran_aware(SubtransactionAwareResource r) throws Inactive, NotSubtransaction, SystemException {
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("ArjunaTransactionImple::register_subtran_aware called for " + get_uid());
    }
    if (r == null)
        throw new BAD_PARAM(0, CompletionStatus.COMPLETED_NO);
    currentStatus = determineStatus(this);
    if (currentStatus != Status.StatusActive) {
        if (currentStatus == Status.StatusMarkedRollback) {
            throw new TRANSACTION_ROLLEDBACK(ExceptionCodes.MARKED_ROLLEDBACK, CompletionStatus.COMPLETED_NO);
        } else
            throw new Inactive();
    }
    if (this == rootAction) {
        if (jtsLogger.logger.isTraceEnabled()) {
            jtsLogger.logger.trace("ArjunaTransactionImple::register_subtran_aware called for " + get_uid() + " : not a subtransaction!");
        }
        throw new NotSubtransaction();
    } else {
        Coordinator coord = null;
        AbstractRecord corbaRec = null;
        try {
            coord = parentHandle.get_coordinator();
            corbaRec = createOTSRecord(false, r, coord);
        } catch (Unavailable ex) {
            throw new UNKNOWN(ExceptionCodes.INACTIVE_TRANSACTION, // what else to raise?
            CompletionStatus.COMPLETED_NO);
        }
        coord = null;
        if (add(corbaRec) != AddOutcome.AR_ADDED) {
            if (jtsLogger.logger.isTraceEnabled()) {
                jtsLogger.logger.trace("ArjunaTransactionImple::register_subtran_aware called for " + get_uid() + " : could not add.");
            }
            corbaRec = null;
            // what else to raise??
            throw new Inactive();
        }
    }
    if (jtsLogger.logger.isTraceEnabled()) {
        jtsLogger.logger.trace("ArjunaTransactionImple::register_subtran_aware called for " + get_uid() + " : subtran_aware_resource registered");
    }
}
Also used : BAD_PARAM(org.omg.CORBA.BAD_PARAM) NotSubtransaction(org.omg.CosTransactions.NotSubtransaction) OTSAbstractRecord(com.arjuna.ArjunaOTS.OTSAbstractRecord) AbstractRecord(com.arjuna.ats.arjuna.coordinator.AbstractRecord) Inactive(org.omg.CosTransactions.Inactive) UNKNOWN(org.omg.CORBA.UNKNOWN) UidCoordinator(com.arjuna.ArjunaOTS.UidCoordinator) RecoveryCoordinator(org.omg.CosTransactions.RecoveryCoordinator) Coordinator(org.omg.CosTransactions.Coordinator) TRANSACTION_ROLLEDBACK(org.omg.CORBA.TRANSACTION_ROLLEDBACK) SynchronizationUnavailable(org.omg.CosTransactions.SynchronizationUnavailable) SubtransactionsUnavailable(org.omg.CosTransactions.SubtransactionsUnavailable) Unavailable(org.omg.CosTransactions.Unavailable)

Aggregations

OTSAbstractRecord (com.arjuna.ArjunaOTS.OTSAbstractRecord)1 UidCoordinator (com.arjuna.ArjunaOTS.UidCoordinator)1 AbstractRecord (com.arjuna.ats.arjuna.coordinator.AbstractRecord)1 BAD_PARAM (org.omg.CORBA.BAD_PARAM)1 TRANSACTION_ROLLEDBACK (org.omg.CORBA.TRANSACTION_ROLLEDBACK)1 UNKNOWN (org.omg.CORBA.UNKNOWN)1 Coordinator (org.omg.CosTransactions.Coordinator)1 Inactive (org.omg.CosTransactions.Inactive)1 NotSubtransaction (org.omg.CosTransactions.NotSubtransaction)1 RecoveryCoordinator (org.omg.CosTransactions.RecoveryCoordinator)1 SubtransactionsUnavailable (org.omg.CosTransactions.SubtransactionsUnavailable)1 SynchronizationUnavailable (org.omg.CosTransactions.SynchronizationUnavailable)1 Unavailable (org.omg.CosTransactions.Unavailable)1