use of com.hazelcast.collection.impl.collection.CollectionItem in project hazelcast by hazelcast.
the class ListContainer method rollbackRemove.
@Override
public void rollbackRemove(long itemId) {
TxCollectionItem txItem = txMap.remove(itemId);
if (txItem == null) {
logger.warning("Transaction log cannot be found for rolling back 'remove()' operation." + " Missing log item id: " + itemId);
return;
}
CollectionItem item = new CollectionItem(itemId, txItem.getValue());
addTxItemOrdered(item);
}
use of com.hazelcast.collection.impl.collection.CollectionItem in project hazelcast by hazelcast.
the class ListContainer method indexOf.
public int indexOf(boolean last, Data value) {
final List<CollectionItem> list = getCollection();
if (last) {
int index = list.size();
final ListIterator<CollectionItem> iterator = list.listIterator(index);
while (iterator.hasPrevious()) {
final CollectionItem item = iterator.previous();
index--;
if (value.equals(item.getValue())) {
return index;
}
}
} else {
int index = -1;
for (CollectionItem item : list) {
index++;
if (value.equals(item.getValue())) {
return index;
}
}
}
return -1;
}
use of com.hazelcast.collection.impl.collection.CollectionItem in project hazelcast by hazelcast.
the class CollectionRemoveOperation method run.
@Override
public void run() throws Exception {
response = false;
CollectionContainer collectionContainer = getOrCreateContainer();
CollectionItem item = collectionContainer.remove(value);
if (item != null) {
response = true;
itemId = item.getItemId();
}
}
use of com.hazelcast.collection.impl.collection.CollectionItem in project hazelcast by hazelcast.
the class ListGetOperation method run.
@Override
public void run() throws Exception {
ListContainer listContainer = getOrCreateListContainer();
CollectionItem item = listContainer.get(index);
response = item.getValue();
}
use of com.hazelcast.collection.impl.collection.CollectionItem in project hazelcast by hazelcast.
the class ListRemoveOperation method run.
@Override
public void run() throws Exception {
ListContainer listContainer = getOrCreateListContainer();
final CollectionItem item = listContainer.remove(index);
itemId = item.getItemId();
response = item.getValue();
}
Aggregations