Search in sources :

Example 1 with HammerThreadedObject

use of com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject in project narayana by jbosstm.

the class LockConflictUnitTest method testAtomicObject.

@Test
public void testAtomicObject() throws Exception {
    HammerThreadedObject.object = new AtomicObject();
    HammerThreadedObject object1 = new HammerThreadedObject(2);
    HammerThreadedObject object2 = new HammerThreadedObject(-2);
    HammerThreadedObject.object.setRetry(2);
    object1.start();
    object2.start();
    try {
        object1.join();
        object2.join();
    } catch (InterruptedException e) {
    }
}
Also used : HammerThreadedObject(com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject) AtomicObject(com.hp.mwtests.ts.txoj.common.resources.AtomicObject) Test(org.junit.Test)

Example 2 with HammerThreadedObject

use of com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject in project narayana by jbosstm.

the class Hammer method test.

@Test
public void test() {
    HammerThreadedObject.object = new AtomicObject();
    HammerThreadedObject object1 = new HammerThreadedObject(2);
    HammerThreadedObject object2 = new HammerThreadedObject(-2);
    object1.start();
    object2.start();
    try {
        object1.join();
        object2.join();
    } catch (InterruptedException e) {
    }
}
Also used : HammerThreadedObject(com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject) AtomicObject(com.hp.mwtests.ts.txoj.common.resources.AtomicObject) Test(org.junit.Test)

Example 3 with HammerThreadedObject

use of com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject in project narayana by jbosstm.

the class SharedHammer method main.

public static void main(String[] args) {
    boolean creator = true;
    Uid id = null;
    for (int i = 0; i < args.length; i++) {
        if ("-object".equals(args[i])) {
            creator = false;
            id = new Uid(args[i + 1]);
        }
    }
    if (creator) {
        HammerThreadedObject.object = new AtomicObject();
        System.out.println("Object created with id: " + HammerThreadedObject.object);
    } else
        HammerThreadedObject.object = new AtomicObject(id);
    HammerThreadedObject object1 = new HammerThreadedObject(1);
    object1.start();
    try {
        object1.join();
    } catch (InterruptedException e) {
    }
}
Also used : Uid(com.arjuna.ats.arjuna.common.Uid) HammerThreadedObject(com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject) AtomicObject(com.hp.mwtests.ts.txoj.common.resources.AtomicObject)

Aggregations

AtomicObject (com.hp.mwtests.ts.txoj.common.resources.AtomicObject)3 HammerThreadedObject (com.hp.mwtests.ts.txoj.common.resources.HammerThreadedObject)3 Test (org.junit.Test)2 Uid (com.arjuna.ats.arjuna.common.Uid)1