示例#1
0
        public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state)
        {
            DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state);

            ThreadPool.QueueUserWorkItem(s => Execute(call, result));
            return(result);
        }
示例#2
0
        public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state)
        {
            DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state);

            new Thread(() => Execute(call, result)).Start();
            return(result);
        }
示例#3
0
 public static void Execute(AsyncCall call, DynamoDBAsyncResult result)
 {
     try
     {
         result.Return = call();
     }
     catch (Exception e)
     {
         result.LastException = e;
         result.Return        = null;
     }
     finally
     {
         result.SignalWaitHandle();
         if (result.Callback != null)
         {
             result.Callback(result);
         }
     }
 }
 public static void Execute(AsyncCall call, DynamoDBAsyncResult result)
 {
     try
     {
         result.Return = call();
     }
     catch (Exception e)
     {
         result.LastException = e;
         result.Return = null;
     }
     finally
     {
         result.SignalWaitHandle();
         if (result.Callback != null)
         {
             result.Callback(result);
         }
     }
 }
示例#5
0
        public static object EndOperation(IAsyncResult result)
        {
            DynamoDBAsyncResult asyncResult = result as DynamoDBAsyncResult;

            if (asyncResult == null)
            {
                return(null);
            }

            if (!asyncResult.CompletedSynchronously)
            {
                WaitHandle.WaitAll(new WaitHandle[] { asyncResult.AsyncWaitHandle });
            }

            if (asyncResult.LastException != null)
            {
                AWSSDKUtils.PreserveStackTrace(asyncResult.LastException);
                throw asyncResult.LastException;
            }

            return(asyncResult.Return);
        }
 public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state)
 {
     DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state);
     ThreadPool.QueueUserWorkItem(s => Execute(call, result));
     return result;
 }
示例#7
0
 public static IAsyncResult BeginOperation(AsyncCall call, AsyncCallback callback, object state)
 {
     DynamoDBAsyncResult result = new DynamoDBAsyncResult(callback, state);
     new Thread(() => Execute(call, result)).Start();
     return result;
 }