use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.
the class AITExplicitObjectImpl01 method tran_rollback_writelock.
public void tran_rollback_writelock(Control ctrl) throws InvocationException {
try {
com.arjuna.ats.jts.ExplicitInterposition interposition = new com.arjuna.ats.jts.ExplicitInterposition();
interposition.registerTransaction(ctrl);
AtomicTransaction atomicTransaction = new AtomicTransaction();
try {
atomicTransaction.begin();
if (setlock(new Lock(LockMode.WRITE), 0) == LockResult.GRANTED) {
atomicTransaction.rollback();
} else {
atomicTransaction.rollback();
throw new InvocationException();
}
} catch (InvocationException invocationException) {
interposition.unregisterTransaction();
throw invocationException;
} catch (Exception exception) {
System.err.println("AITExplicitObjectImpl01.tran_rollback_writelock: " + exception);
if (atomicTransaction.get_status() == Status.StatusActive) {
atomicTransaction.rollback();
}
interposition.unregisterTransaction();
throw new InvocationException();
} catch (Error error) {
System.err.println("AITExplicitObjectImpl01.tran_rollback_writelock: " + error);
if (atomicTransaction.get_status() == Status.StatusActive) {
atomicTransaction.rollback();
}
interposition.unregisterTransaction();
throw new InvocationException();
}
interposition.unregisterTransaction();
} catch (InvocationException invocationException) {
throw invocationException;
} catch (Exception exception) {
System.err.println("AITExplicitObjectImpl01.tran_rollback_writelock: " + exception);
throw new InvocationException();
}
}
use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.
the class Client_ImplicitObject_TranCommit_NoTranReadLock method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String prefix = args[args.length - 3];
int numberOfCalls = Integer.parseInt(args[args.length - 2]);
String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
boolean correct = true;
Date start = new Date();
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
implicitObject.no_tran_readlock();
atomicTransaction.commit(true);
}
Date end = new Date();
float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
System.err.println("Operation duration : " + operationDuration + "ms");
System.err.println("Test duration : " + (end.getTime() - start.getTime()) + "ms");
correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranCommit_NoTranReadLock", operationDuration);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client_ImplicitObject_TranCommit_NoTranReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client_ImplicitObject_TranCommit_NoTranReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.
the class Client_ImplicitObject_TranCommit_TranRollbackReadLock method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String prefix = args[args.length - 3];
int numberOfCalls = Integer.parseInt(args[args.length - 2]);
String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
boolean correct = true;
Date start = new Date();
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
implicitObject.tran_rollback_readlock();
atomicTransaction.commit(true);
}
Date end = new Date();
float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
System.err.println("Operation duration : " + operationDuration + "ms");
System.err.println("Test duration : " + (end.getTime() - start.getTime()) + "ms");
correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranCommit_TranRollbackReadLock", operationDuration);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client_ImplicitObject_TranCommit_TranRollbackReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client_ImplicitObject_TranCommit_TranRollbackReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.
the class Client_ImplicitObject_TranRollback_NoTranWriteLock method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String prefix = args[args.length - 3];
int numberOfCalls = Integer.parseInt(args[args.length - 2]);
String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
boolean correct = true;
Date start = new Date();
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
implicitObject.no_tran_writelock();
atomicTransaction.rollback();
}
Date end = new Date();
float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
System.err.println("Operation duration : " + operationDuration + "ms");
System.err.println("Test duration : " + (end.getTime() - start.getTime()) + "ms");
correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranRollback_NoTranWriteLock", operationDuration);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client_ImplicitObject_TranRollback_NoTranWriteLock.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client_ImplicitObject_TranRollback_NoTranWriteLock.main: " + exception);
exception.printStackTrace(System.err);
}
}
use of com.arjuna.ats.jts.extensions.AtomicTransaction in project narayana by jbosstm.
the class Client_ImplicitObject_TranRollback_TranCommitReadLock method main.
public static void main(String[] args) {
try {
ORBInterface.initORB(args, null);
OAInterface.initOA();
String prefix = args[args.length - 3];
int numberOfCalls = Integer.parseInt(args[args.length - 2]);
String implicitObjectIOR = ServerIORStore.loadIOR(args[args.length - 1]);
ImplicitObject implicitObject = ImplicitObjectHelper.narrow(ORBInterface.orb().string_to_object(implicitObjectIOR));
boolean correct = true;
Date start = new Date();
for (int index = 0; index < numberOfCalls; index++) {
AtomicTransaction atomicTransaction = new AtomicTransaction();
atomicTransaction.begin();
implicitObject.tran_commit_readlock();
atomicTransaction.rollback();
}
Date end = new Date();
float operationDuration = ((float) (end.getTime() - start.getTime())) / ((float) numberOfCalls);
System.err.println("Operation duration : " + operationDuration + "ms");
System.err.println("Test duration : " + (end.getTime() - start.getTime()) + "ms");
correct = PerformanceProfileStore.checkPerformance(prefix + "_ImplicitObject_TranRollback_TranCommitReadLock", operationDuration);
if (correct) {
System.out.println("Passed");
} else {
System.out.println("Failed");
}
} catch (Exception exception) {
System.out.println("Failed");
System.err.println("Client_ImplicitObject_TranRollback_TranCommitReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
try {
OAInterface.shutdownOA();
ORBInterface.shutdownORB();
} catch (Exception exception) {
System.err.println("Client_ImplicitObject_TranRollback_TranCommitReadLock.main: " + exception);
exception.printStackTrace(System.err);
}
}
Aggregations