Ejemplo n.º 1
0
        private void ProcessSingleStageTransactionRequest(TransactionRequest transactionRequest, IClient client,
                                                          SafeDictionary <string, DataStore> dataStores)
        {
            var types = transactionRequest.AllCollections;


            _lockManager.DoWithWriteLock(() =>
            {
                try
                {
                    Dbg.Trace($"S: fallback to single stage for transaction {transactionRequest.TransactionId}");


                    // check the conditions (in case of conditional update)
                    CheckConditions(transactionRequest, dataStores);

                    SaveDurableTransaction(transactionRequest, dataStores);

                    // update the data in memory
                    ExecuteInMemory(transactionRequest, dataStores);

                    client.SendResponse(new NullResponse());

                    Dbg.Trace($"S: end writing delayed transaction {transactionRequest.TransactionId}");
                }
                catch (CacheException e)
                {
                    client.SendResponse(new ExceptionResponse(e, e.ExceptionType));
                }
                catch (Exception e)
                {
                    Dbg.Trace($"error writing delayed transaction:{e.Message}");
                    client.SendResponse(new ExceptionResponse(e));
                    // failed to write a durable transaction so stop here
                }
            }, types);
        }