use of com.hp.mwtests.ts.jts.exceptions.TestException in project narayana by jbosstm.
the class AtomicObject method get.
public synchronized int get() throws TestException {
CurrentImple current = OTSImpleManager.current();
int value = -1;
try {
current.begin();
if (setlock(new Lock(LockMode.READ), 5) == LockResult.GRANTED) {
value = _value;
current.commit(false);
return value;
} else {
current.rollback();
throw new TestException("Could not setlock");
}
} catch (Exception e) {
throw new TestException(e);
}
}
use of com.hp.mwtests.ts.jts.exceptions.TestException in project narayana by jbosstm.
the class AtomicWorker1 method get1.
public static int get1() throws Exception {
boolean res = false;
int returnValue = -1;
try {
current.begin();
try {
returnValue = atomicObject_1.get();
res = true;
} catch (TestException e) {
}
if (res)
current.commit(false);
else
current.rollback();
} catch (Exception e) {
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get1: Failed to retrieve value");
return (returnValue);
}
use of com.hp.mwtests.ts.jts.exceptions.TestException in project narayana by jbosstm.
the class AtomicWorker1 method get2.
public static int get2() throws Exception {
boolean res = false;
int returnValue = -1;
try {
current.begin();
try {
returnValue = atomicObject_2.get();
res = true;
} catch (TestException e) {
}
if (res)
current.commit(false);
else
current.rollback();
} catch (Exception e) {
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get2: Failed to retrieve value");
return (returnValue);
}
use of com.hp.mwtests.ts.jts.exceptions.TestException in project narayana by jbosstm.
the class AtomicWorker2 method get2.
public static int get2() throws Exception {
boolean res = false;
int returnValue = -1;
try {
current.begin();
try {
returnValue = atomicObject_2.get();
res = true;
} catch (TestException e) {
}
if (res)
current.commit(false);
else
current.rollback();
} catch (Exception e) {
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get2: Failed to retrieve value");
return (returnValue);
}
use of com.hp.mwtests.ts.jts.exceptions.TestException in project narayana by jbosstm.
the class AtomicWorker2 method get1.
public static int get1() throws Exception {
boolean res = false;
int returnValue = -1;
try {
current.begin();
try {
returnValue = atomicObject_1.get();
res = true;
} catch (TestException e) {
}
if (res)
current.commit(false);
else
current.rollback();
} catch (Exception e) {
System.err.println(e);
throw e;
}
if (!res)
throw new Exception("Get1: Failed to retrieve value");
return (returnValue);
}
Aggregations