Exemplo n.º 1
0
        private void CollectAndSortNodeIds(long nodeId, Transaction transaction, NodeCursor nodes)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableLongSet nodeIdSet = new org.eclipse.collections.impl.set.mutable.primitive.LongHashSet();
            MutableLongSet nodeIdSet = new LongHashSet();

            nodeIdSet.add(nodeId);

            [email protected] read = transaction.DataRead();
            read.SingleNode(nodeId, nodes);
            if (!nodes.Next())
            {
                this._sortedNodeIds = _empty;
                return;
            }
            using (RelationshipSelectionCursor rels = RelationshipSelections.allCursor(transaction.Cursors(), nodes, null))
            {
                while (rels.Next())
                {
                    if (_firstRelId == NO_SUCH_RELATIONSHIP)
                    {
                        _firstRelId = rels.RelationshipReference();
                    }

                    nodeIdSet.add(rels.SourceNodeReference());
                    nodeIdSet.add(rels.TargetNodeReference());
                }
            }

            this._sortedNodeIds = nodeIdSet.toSortedArray();
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: void lockAllNodesAndConsumeRelationships(long nodeId, final org.neo4j.internal.kernel.api.Transaction transaction, org.neo4j.internal.kernel.api.NodeCursor nodes) throws org.neo4j.internal.kernel.api.exceptions.KernelException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        internal virtual void LockAllNodesAndConsumeRelationships(long nodeId, Transaction transaction, NodeCursor nodes)
        {
            bool retry;

            do
            {
                retry       = false;
                _firstRelId = NO_SUCH_RELATIONSHIP;

                // lock all the nodes involved by following the node id ordering
                CollectAndSortNodeIds(nodeId, transaction, nodes);
                LockAllNodes(_sortedNodeIds);

                // perform the action on each relationship, we will retry if the the relationship iterator contains
                // new relationships
                [email protected] read = transaction.DataRead();
                read.SingleNode(nodeId, nodes);
                //if the node is not there, someone else probably deleted it, just ignore
                if (nodes.Next())
                {
                    using (RelationshipSelectionCursor rels = RelationshipSelections.allCursor(transaction.Cursors(), nodes, null))
                    {
                        bool first = true;
                        while (rels.Next() && !retry)
                        {
                            retry = PerformAction(rels.RelationshipReference(), first);
                            first = false;
                        }
                    }
                }
            } while (retry);
        }
Exemplo n.º 3
0
 public RelationshipSelectionCursorAnonymousInnerClass(RelationshipSelectionCursor allRelationships, long toNode)
 {
     this._allRelationships = allRelationships;
     this._toNode           = toNode;
 }
Exemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private static org.neo4j.internal.kernel.api.helpers.RelationshipSelectionCursor connectingRelationshipsIterator(final org.neo4j.internal.kernel.api.helpers.RelationshipSelectionCursor allRelationships, final long toNode)
        private static RelationshipSelectionCursor ConnectingRelationshipsIterator(RelationshipSelectionCursor allRelationships, long toNode)
        {
            return(new RelationshipSelectionCursorAnonymousInnerClass(allRelationships, toNode));
        }