Hi guys, will the following code be good enough to
test locking/unlocking. I am getting unexcepted results like Secruity Excpetion, just wondering whether I am on the right track.
public class LockTesting extends
Thread {
private static Data data1;
public static void main(
String[] args) {
data1 = new Data();
LockTesting test1 = new LockTesting();
LockTesting test2 = new LockTesting();
LockTesting test3 = new LockTesting();
LockTesting test4 = new LockTesting();
LockTesting test5 = new LockTesting();
test1.start();
test2.start();
test3.start();
test4.start();
test5.start();
}
public void run() {
for (int x = 0; x < 30; x++) {
long cookie1 = data1.lockRecord(1);
data1.unlock(1, cookie1);
long cookie2 = data1.lockRecord(2);
data1.unlock(2, cookie2);
long cookie3 = data1.lockRecord(3);
data1.unlock(3, cookie3);
long cookie4 = data1.lockRecord(4);
data1.unlock(4, cookie4);
long cookie5 = data1.lockRecord(5);
data1.unlock(5, cookie5);
long cookie6 = data1.lockRecord(6);
data1.unlock(6, cookie6);
}
}
}