/// <summary>
 /// Wait for completion of the request and return the result (or throw an exception if there was a failure).
 /// </summary>
 /// <param name="asyncResponse">The execution handle for the request</param>
 /// <returns>The request's response</returns>
 private AsyncResponse <TResult> EndExecute(AsyncResponse <TResult> asyncResponse)
 {
     if (asyncResponse.Procedure != this.Name)
     {
         throw new ArgumentException(Resources.AsyncResponseMismatch);
     }
     return(VoltConnection.EndExecute <TResult>(asyncResponse));
 }
コード例 #2
0
 /// <summary>Initializes a new instance of the <see cref="VoltConnectionProxy"/> class.</summary>
 /// <param name="pool">The pool.</param>
 /// <param name="settings">The settings.</param>
 /// <param name="isPersistent">if set to <c>true</c> [is persistent].</param>
 public VoltConnectionProxy(
     VoltDBConnectionPool pool,
     ConnectionSettings settings,
     bool isPersistent = false)
 {
     this.pool         = pool;
     this.connection   = VoltConnection.Create(settings);
     this.isPersistent = isPersistent;
 }
コード例 #3
0
 /// <summary>
 /// Internal constructor: factory protocol only.
 /// </summary>
 /// <param name="executor">Connection that will execute requests for this procedure wrapper.</param>
 /// <param name="name">Name of the procedure.</param>
 /// <param name="timeout">Wrapper-specific command timeout.</param>
 /// <param name="callback">Execution callback.</param>
 internal ProcedureWrapper(VoltConnection executor, string name, int timeout, ExecuteAsyncCallback <TResult> callback)
     : base(executor, name, timeout)
 {
     this.Callback = callback;
 }
コード例 #4
0
 /// <summary>
 /// Creates a new instance of this class using the provided executor.  Internal usage only: the executor
 /// itselt will validate it has statistics access before hooking up this class.
 /// </summary>
 /// <param name="executor">Connection that will execute the requests.</param>
 internal StatisticsAccess(VoltConnection executor)
 {
     this.Executor = executor;
 }
コード例 #5
0
 /// <summary>
 /// Creates a new instance of this class using the provided executor.  Internal usage only: the executor
 /// itselt will validate it has root access before hooking up this class.
 /// </summary>
 /// <param name="executor">Connection that will execute the requests.</param>
 internal SystemAccess(VoltConnection executor)
 {
     this.Executor = executor;
 }
コード例 #6
0
 /// <summary>
 /// Creates a new instance of this class using the provided executor.  Internal usage only: the executor
 /// itselt will validate access before hooking up this class.
 /// </summary>
 /// <param name="executor">Connection that will execute the requests.</param>
 internal InfoAccess(VoltConnection executor)
 {
     this.Executor = executor;
 }
コード例 #7
0
 /// <summary>
 /// Creates a new instance of this class using the provided executor.  Internal usage only: the executor
 /// itselt will validate it has adhoc access before hooking up this class.
 /// </summary>
 /// <param name="executor">Connection that will execute the requests.</param>
 internal AdhocAccess(VoltConnection executor)
 {
     this.Executor = executor;
 }
コード例 #8
0
 /// <summary>
 /// Changes the connection against which the wrapper will execute (allows for wrapper re-use accross
 /// multiple connections - posted executions in progress will not be impacted by the change as the
 /// response will be managed on the original connection).
 /// </summary>
 /// <param name="connection">The new connection to which the wrapper should be tied.</param>
 public void SetConnection(VoltConnection connection)
 {
     this.Executor = connection;
 }
コード例 #9
0
 /// <summary>
 /// Synchronously execute a procedure against the VoltDB server and block execution of the calling thread.
 /// </summary>
 /// <typeparam name="T">Data type of the expected response result for the call (Table[], Table,
 /// SingleRowTable[], SingleRowTable, T[][], T[] or T, with T one of the supported value types).</typeparam>
 /// <param name="timeout">Timeout value (overrides connection settings DefaultCommandTimeout). Use
 /// Timeout.Infinite or -1 for infinite timeout.</param>
 /// <param name="procedure">The name of the procedure to call.</param>
 /// <param name="procedureUtf8">UTF-8 bytes of the procedure name.</param>
 /// <param name="parameters">List of parameters to pass to the procedure.</param>
 /// <returns>The reponse from the server, containing (if available) the result of the procedure execution
 /// (check .IsError prior to using the result).</returns>
 /// <remarks>Synchronous operations will limit the throughput of your aplication, as each of your request waits
 /// for completion before submitting a new call.  For maximum parallelization and throughput, asynchronous
 /// calls should be made (see BeginExecute).</remarks>
 public override Response <T> Execute <T>(int timeout, string procedure, byte[] procedureUtf8, params object[] parameters)
 {
     // Call the asynchronous method and immediately turn around to call .EndExecute.
     return(VoltConnection.EndExecute <T>(this.BeginExecute <T>(null, null, timeout, procedure, procedureUtf8, parameters)));
 }