Пример #1
0
 /// <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>
 /// 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)));
 }