use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.
the class ThreadObject3a method run.
public void run() {
CurrentImple current = OTSImpleManager.current();
try {
current.begin();
Util.indent(_threadId, 0);
System.out.println("begin");
AtomicWorker3.randomOperation(_threadId, 0);
AtomicWorker3.randomOperation(_threadId, 0);
if (_commit)
current.commit(false);
else
current.rollback();
Util.indent(_threadId, 0);
if (_commit)
System.out.println("end");
else
System.out.println("abort");
} catch (Exception e) {
System.err.println(e);
}
}
use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.
the class trangrid_i method width.
public short width() throws SystemException {
CurrentImple current = OTSImpleManager.current();
org.omg.CosTransactions.Control control = current.get_control();
org.omg.CosTransactions.Control ptr = control;
if (ptr != null) {
System.out.println("trangrid_i.width - found implicit transactional context.");
ptr = null;
} else {
System.err.println("Error: trangrid_i.width - no implicit transactional context.");
System.exit(0);
}
return m_width;
}
use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.
the class trangrid_i method height.
public short height() throws SystemException {
System.out.println("height " + Thread.currentThread());
CurrentImple current = OTSImpleManager.current();
org.omg.CosTransactions.Control control = current.get_control();
org.omg.CosTransactions.Control ptr = control;
if (ptr != null) {
System.out.println("trangrid_i.height - found implicit transactional context.");
ptr = null;
} else {
System.err.println("Error: trangrid_i.height - no implicit transactional context.");
System.exit(0);
}
return m_height;
}
use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.
the class SuspendResume method test.
@Test
public void test() throws Exception {
ORB myORB = null;
RootOA myOA = null;
myORB = ORB.getInstance("test");
myOA = OA.getRootOA(myORB);
myORB.initORB(new String[] {}, null);
myOA.initOA();
ORBManager.setORB(myORB);
ORBManager.setPOA(myOA);
CurrentImple current = OTSImpleManager.current();
Control myControl = null;
System.out.println("Beginning transaction.");
try {
current.begin();
myControl = current.get_control();
assertNotNull(myControl);
} catch (Exception sysEx) {
sysEx.printStackTrace(System.err);
fail();
}
System.out.println("Committing transaction.");
try {
current.commit(true);
current.resume(myControl);
} catch (Exception e) {
fail("commit error: " + e);
e.printStackTrace(System.err);
}
myOA.destroy();
myORB.shutdown();
System.out.println("Test completed successfully.");
}
use of com.arjuna.ats.internal.jts.orbspecific.CurrentImple in project narayana by jbosstm.
the class ExplicitInterClient method main.
public static void main(String[] args) throws Exception {
ServerORB orb = new ServerORB();
ORB myORB = orb.getORB();
RootOA myOA = orb.getOA();
CurrentImple current = OTSImpleManager.current();
Control theControl = null;
String objectReference = args[0];
SetGet SetGetVar = null;
short h = 0;
try {
current.begin();
current.begin();
current.begin();
} catch (Exception e) {
TestUtility.fail("Caught exception during begin: " + e);
e.printStackTrace(System.err);
}
try {
Services serv = new Services(myORB);
SetGetVar = SetGetHelper.narrow(myORB.orb().string_to_object(TestUtility.getService(objectReference)));
} catch (Exception ex) {
TestUtility.fail("Failed to bind to setget server: " + ex);
ex.printStackTrace(System.err);
}
try {
theControl = current.get_control();
SetGetVar.set((short) 2, theControl);
// SetGetVar.set((short) 2, theControl);
theControl = null;
System.out.println("Set value.");
} catch (Exception ex1) {
TestUtility.fail("Unexpected system exception during set: " + ex1);
ex1.printStackTrace(System.err);
}
try {
System.out.println("committing first nested action");
current.commit(true);
// SetGetVar.set((short) 4, current.get_control());
System.out.println("committing second nested action");
current.commit(true);
} catch (Exception sysEx) {
TestUtility.fail("Caught unexpected exception during commit: " + sysEx);
sysEx.printStackTrace(System.err);
}
try {
theControl = current.get_control();
h = SetGetVar.get(theControl);
theControl = null;
System.out.println("Got value.");
} catch (Exception ex2) {
TestUtility.fail("Unexpected system exception during get: " + ex2);
ex2.printStackTrace(System.err);
}
try {
current.commit(true);
System.out.println("committed top-level action");
} catch (Exception ep) {
TestUtility.fail("Caught commit exception for top-level action: " + ep);
ep.printStackTrace(System.err);
}
myOA.destroy();
myORB.shutdown();
System.out.println("Passed");
}
Aggregations