Exemplo n.º 1
0
            protected internal override Pair <ClusterAction, ClusterState> fetchNextOrNull()
            {
                try
                {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    if (_actions.hasNext())
                    {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                        ClusterAction action = _actions.next();
                        return(Pair.of(action, outerInstance.PerformAction(action)));
                    }
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                    else if (_instancesWithTimeouts.hasNext())
                    {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                        ClusterInstance instance = _instancesWithTimeouts.next();
                        return(outerInstance.performNextTimeoutFrom(instance));
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch (Exception e)
                {
                    throw new Exception(e);
                }
            }
Exemplo n.º 2
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            ClusterInstance that = ( ClusterInstance )o;

            if (!ToString().Equals(that.ToString()))
            {
                return(false);
            }

            if (!_uri.Equals(that._uri))
            {
                return(false);
            }

            // TODO: For now, we only look at the states of the underlying state machines,
            // and ignore, at our peril, the MultiPaxosContext as part of this equality checks.
            // This means the prover ignores lots of possible paths it could generate, as it considers two
            // machines with different multi paxos state potentially equal and will ignore exploring both.
            // This should be undone as soon as possible. It's here because we need a better mechanism than
            // .equals() to compare that two contexts are the same, which is not yet implemented.

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Managing timeouts is trickier than putting all of them in a long list, like regular message delivery.
        ///  Timeouts are ordered and can be cancelled, so they need special treatment. Hence a separate method for
        ///  managing timeouts triggering.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.helpers.collection.Pair<ClusterAction, ClusterState> performNextTimeoutFrom(ClusterInstance instance) throws Exception
        private Pair <ClusterAction, ClusterState> PerformNextTimeoutFrom(ClusterInstance instance)
        {
            ClusterState  newState      = Snapshot();
            ClusterAction clusterAction = newState.Instance(instance.Uri().toASCIIString()).popTimeout();

            clusterAction.Perform(newState);

            return(Pair.of(clusterAction, newState));
        }