use of com.hazelcast.collection.impl.list.ListContainer in project hazelcast by hazelcast.
the class ListKeyValueSource method open.
@Override
public boolean open(NodeEngine nodeEngine) {
NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
ss = nei.getSerializationService();
Address thisAddress = nei.getThisAddress();
IPartitionService ps = nei.getPartitionService();
Data data = ss.toData(listName, StringAndPartitionAwarePartitioningStrategy.INSTANCE);
int partitionId = ps.getPartitionId(data);
Address partitionOwner = ps.getPartitionOwner(partitionId);
if (partitionOwner == null) {
return false;
}
if (thisAddress.equals(partitionOwner)) {
ListService listService = nei.getService(ListService.SERVICE_NAME);
ListContainer listContainer = listService.getOrCreateContainer(listName, false);
List<CollectionItem> items = new ArrayList<CollectionItem>(listContainer.getCollection());
iterator = items.iterator();
}
return true;
}
Aggregations