Example #1
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));
        }
Example #2
0
        /// <summary>
        /// Clone the state and perform the action with the provided index. Returns the new state and the action. </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: ClusterState performAction(ClusterAction action) throws Exception
        internal virtual ClusterState PerformAction(ClusterAction action)
        {
            ClusterState newState = Snapshot();

            // Remove the action from the list of things that can happen in the snapshot
            newState._pendingActions.remove(action);

            // Perform the action on the cloned state
            IEnumerable <ClusterAction> newActions = action.Perform(newState);

            // Include any outcome actions into the new state snapshot
            newState._pendingActions.addAll(Iterables.asCollection(newActions));

            return(newState);
        }