Exemplo n.º 1
0
        /// <summary>
        /// Create a FailPoint and executes a configureFailPoint command on the selected server.
        /// </summary>
        /// <param name="server">The server.</param>
        /// <param name="session">The session.</param>
        /// <param name="command">The command.</param>
        /// <returns>A FailPoint containing the proper binding.</returns>
        public static FailPoint Configure(IServer server, ICoreSessionHandle session, BsonDocument command)
        {
            var binding   = new SingleServerReadWriteBinding(server, session.Fork());
            var failpoint = new FailPoint(server, binding, command);

            try
            {
                failpoint.Configure();
                return(failpoint);
            }
            catch
            {
                try { failpoint.Dispose(); } catch { }
                throw;
            }
        }
Exemplo n.º 2
0
        // public static methods
        /// <summary>
        /// Create a FailPoint and executes a configureFailPoint command on the selected server.
        /// </summary>
        /// <param name="cluster">The cluster.</param>
        /// <param name="session">The session.</param>
        /// <param name="name">The name.</param>
        /// <param name="args">The arguments for the FailPoint.</param>
        /// <returns>A FailPoint containing the proper binding.</returns>
        public static FailPoint Configure(ICluster cluster, ICoreSessionHandle session, string name, BsonDocument args)
        {
            var server    = GetWriteableServer(cluster);
            var binding   = new SingleServerReadWriteBinding(server, session.Fork());
            var failpoint = new FailPoint(server, binding, name, args);

            try
            {
                failpoint.Configure();
                return(failpoint);
            }
            catch
            {
                try { failpoint.Dispose(); } catch { }
                throw;
            }
        }
Exemplo n.º 3
0
        // public static methods
        /// <summary>
        /// Create a FailPoint and executes a configureFailPoint command on the selected server.
        /// </summary>
        /// <param name="cluster">The cluster.</param>
        /// <param name="session">The session.</param>
        /// <param name="command">The command.</param>
        /// <returns>A FailPoint containing the proper binding.</returns>
        public static FailPoint Configure(ICluster cluster, ICoreSessionHandle session, BsonDocument command)
        {
            var server = GetWriteableServer(cluster);

            return(FailPoint.Configure(server, session, command));
        }