final String name = "testScalableList5";
final String iterName = "testIterator5";
final String iterName2 = "testIterator6";
// create the list
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() throws Exception {
ScalableList<String> list = new ScalableList<String>(3, 1);
for (int i = 0; i < 10; i++) {
list.add(Integer.toString(i));
}
AppContext.getDataManager().setBinding(name, list);
}
}, taskOwner);
// create iterators, iterate to a certain location
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() throws Exception {
ScalableList<String> list =
uncheckedCast(AppContext.getDataManager().getBinding(
name));
ListIterator<String> iter = list.listIterator();
ListIterator<String> iter2 = list.listIterator();
ManagedSerializable<ListIterator<String>> mgdIterator =
new ManagedSerializable<ListIterator<String>>(iter);
AppContext.getDataManager().setBinding(iterName, mgdIterator);
ManagedSerializable<ListIterator<String>> mgdIterator2 =
new ManagedSerializable<ListIterator<String>>(iter2);
AppContext.getDataManager().setBinding(iterName2,
mgdIterator2);
}
}, taskOwner);
// try adding/removing
txnScheduler.runTask(new TestAbstractKernelRunnable() {
public void run() throws Exception {
Random random = new Random(randomSeed);
ScalableList<String> list =
uncheckedCast(AppContext.getDataManager().getBinding(
name));