use of com.arjuna.ats.arjuna.coordinator.AbstractRecord 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");
}
}
use of com.arjuna.ats.arjuna.coordinator.AbstractRecord in project narayana by jbosstm.
the class RecoveredServerTransaction method addResourceRecord.
/**
* Allows a new Resource to be added to the transaction. Typically this is
* used to replace a Resource that has failed and cannot be recovered on
* it's original IOR.
*/
public void addResourceRecord(Uid rcUid, Resource r) {
Coordinator coord = null;
AbstractRecord corbaRec = createOTSRecord(true, r, coord, rcUid);
addRecord(corbaRec);
}
use of com.arjuna.ats.arjuna.coordinator.AbstractRecord in project narayana by jbosstm.
the class EditableAtomicAction method toString.
public String toString() {
if (!_activated)
return "RecoveryAction not activated.";
else {
String printableForm = "ActionStatus: " + ActionStatus.stringForm(super.status());
printableForm += "\nHeuristic Decision: " + TwoPhaseOutcome.stringForm(super.getHeuristicDecision());
if (super.preparedList.size() == 0)
printableForm += "\nNo prepared entries.";
else {
printableForm += "\nPrepared entries:";
RecordListIterator iter = new RecordListIterator(super.preparedList);
AbstractRecord rec = iter.iterate();
int i = 0;
while (rec != null) {
printableForm += "\n[" + i + "] " + rec;
rec = iter.iterate();
i++;
}
}
if (super.heuristicList.size() == 0)
printableForm += "\nNo heuristic entries.";
else {
printableForm += "\nHeuristic entries:";
RecordListIterator iter = new RecordListIterator(super.heuristicList);
AbstractRecord rec = iter.iterate();
int i = 0;
while (rec != null) {
printableForm += "\n[" + i + "] " + rec;
rec = iter.iterate();
i++;
}
}
return printableForm;
}
}
use of com.arjuna.ats.arjuna.coordinator.AbstractRecord in project narayana by jbosstm.
the class EditableAtomicAction method moveHeuristicToPrepared.
/**
* Move a previous heuristic participant back to the prepared list so that recovery
* can try again. If it fails again then it may end up back on the heuristic list.
*/
public void moveHeuristicToPrepared(int index) throws IndexOutOfBoundsException {
if ((index < 0) || (index >= super.heuristicList.size()))
throw new IndexOutOfBoundsException();
else {
if (super.heuristicList.size() == 0)
throw new IndexOutOfBoundsException();
RecordListIterator iter = new RecordListIterator(super.heuristicList);
AbstractRecord rec = iter.iterate();
for (int i = 0; i < index; i++) rec = iter.iterate();
if (rec.forgetHeuristic()) {
/*
* Move from heuristic list to prepared list.
*/
super.heuristicList.remove(rec);
super.preparedList.insert(rec);
if (super.heuristicList.size() == 0)
super.setHeuristicDecision(TwoPhaseOutcome.FINISH_OK);
super.updateState();
} else {
tsLogger.i18NLogger.warn_tools_log_eaa2();
}
}
}
use of com.arjuna.ats.arjuna.coordinator.AbstractRecord in project narayana by jbosstm.
the class AtomicActionTestBase method testPrepareWithLRRFailOn2PCUnawareResourcePrepare.
protected void testPrepareWithLRRFailOn2PCUnawareResourcePrepare() {
OnePhase onePhase = new OnePhase();
AbstractRecord lastResourceRecord = new LastResourceShutdownRecord(onePhase, true);
AbstractRecord basicRecord = new BasicRecord();
executeTest(true, ActionStatus.ABORTED, null, lastResourceRecord, basicRecord);
Assert.assertEquals(OnePhase.ROLLEDBACK, onePhase.status());
}
Aggregations