- String localMemberName = datastore.getActorContext().getCurrentMemberName();
- Optional<DataContainerChild<? extends PathArgument, ?>> ownerLeaf = ((MapEntryNode)entityNode.get()).
- getChild(ENTITY_OWNER_NODE_ID);
+ // Check if there are any candidates, if there are none we do not really have ownership state
+ final MapEntryNode entity = (MapEntryNode) entityNode.get();
+ final Optional<DataContainerChild<? extends PathArgument, ?>> optionalCandidates = entity.getChild(CANDIDATE_NODE_ID);
+ final boolean hasCandidates = optionalCandidates.isPresent() && ((MapNode) optionalCandidates.get()).getValue().size() > 0;
+ if(!hasCandidates){
+ return Optional.absent();
+ }
+
+ String localMemberName = context.getCurrentMemberName();
+ Optional<DataContainerChild<? extends PathArgument, ?>> ownerLeaf = entity.getChild(ENTITY_OWNER_NODE_ID);