use of com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl in project narayana by jbosstm.
the class ServerNestedStrictUnitTest method testCommit.
@Test
public void testCommit() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerStrictNestedAction act = new ServerStrictNestedAction(sc, true);
assertFalse(act.interposeResource());
act.commit_subtransaction(null);
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl in project narayana by jbosstm.
the class ServerTopLevelOSIActionUnitTest method testCommit.
@Test
public void testCommit() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
assertEquals(act.prepare(), Vote.VoteReadOnly);
try {
act.commit();
fail();
} catch (final INVALID_TRANSACTION ex) {
}
assertTrue(act.getReference() != null);
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl in project narayana by jbosstm.
the class ServerTopLevelOSIActionUnitTest method testCommitOnePhase.
@Test
public void testCommitOnePhase() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
act.commit_one_phase();
assertTrue(act.type() != null);
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl in project narayana by jbosstm.
the class ServerTopLevelOSIActionUnitTest method testRollback.
@Test
public void testRollback() throws Exception {
ControlImple cont = new ControlImple(null, null);
Control theControl = cont.getControl();
ArjunaTransactionImple tx = cont.getImplHandle();
ServerControl sc = new ServerControl(tx.get_uid(), theControl, tx, theControl.get_coordinator(), theControl.get_terminator());
ServerOSITopLevelAction act = new ServerOSITopLevelAction(sc, true);
assertEquals(act.prepare(), Vote.VoteReadOnly);
try {
act.rollback();
fail();
} catch (final INVALID_TRANSACTION ex) {
}
act.forget();
}
use of com.arjuna.ats.internal.jts.orbspecific.interposition.ServerControl in project narayana by jbosstm.
the class RecoveredServerTransaction method getStatusFromParent.
private Status getStatusFromParent() {
Status theStatus = Status.StatusUnknown;
// This variable is applied with Orbix
int not_exist_count;
if ((super._recoveryCoordinator != null) && (get_status() == Status.StatusPrepared)) {
ServerControl sc = new ServerControl((ServerTransaction) this);
ServerRecoveryTopLevelAction tla = new ServerRecoveryTopLevelAction(sc);
if (tla.valid()) {
try {
theStatus = super._recoveryCoordinator.replay_completion(tla.getReference());
if (jtsLogger.logger.isDebugEnabled()) {
jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent - replay_completion status = " + Utility.stringStatus(theStatus));
}
} catch (TRANSIENT ex_trans) {
/*
* A failure that might not occur again if the request is retried. Not definite.
*/
jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_10(get_uid());
theStatus = Status.StatusUnknown;
}// What here what should be done for Orbix2000
catch (OBJECT_NOT_EXIST ex) {
// i believe this state should be notran - ots explicitly
// objnotexist is
// rollback
theStatus = Status.StatusRolledBack;
if (jtsLogger.logger.isDebugEnabled()) {
jtsLogger.logger.debug("RecoveredServerTransaction.getStatusFromParent -" + " replay_completion got object_not_exist = " + Utility.stringStatus(theStatus));
}
} catch (NotPrepared ex1) {
jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_12();
theStatus = Status.StatusActive;
} catch (Exception e) {
// Unknown error, so better to do nothing at this stage.
jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_13(e);
}
} else {
jtsLogger.i18NLogger.warn_recovery_transactions_RecoveredServerTransaction_14(get_uid());
}
// Make sure we "delete" these objects when we are finished
// with them or there will be a memory leak. If they are deleted
// "early", and the root coordinator needs them then it will find
// them unavailable, and will have to retry recovery later.
sc = null;
tla = null;
} else {
if (jtsLogger.logger.isDebugEnabled()) {
jtsLogger.logger.debug("RecoveredServerTransaction:getStatusFromParent - " + "no recovcoord or status not prepared");
}
}
return theStatus;
}
Aggregations