Ejemplo n.º 1
0
 public void DropRecord(string dbName, string tableName, object recordKey)
 {
     try {
         TXN_BEGIN(dbName: dbName, tableName: tableName, recordKey: recordKey);
         DataFunctions.DropRecord(activeDStore, dbName, tableName, recordKey);
     }
     finally {
         TXN_END();
     }
 }
Ejemplo n.º 2
0
        private void ReleaseLocks()
        {
            logger.Debug("RECORD UN-LOCK");

            // open datastore for exclusive access
            using (var dstore = new DataStore(ActiveDataStoreType, exclusive: true)) {
                try {
                    // get all existing locks
                    // release locks belonging to this connection
                    foreach (ConnectionLock activeLock in ReadActiveLocks(dstore))
                    {
                        logger.Debug("Lock found: {0}", activeLock);
                        if (activeLock.BelongsTo(this))
                        {
                            logger.Debug("Dropping lock: {0}", activeLock);
                            DataFunctions.DropRecord(dstore, connDbName, connDbLocksTableName, activeLock.LockId);
                        }
                    }
                }
                catch (Exception dropEx) {
                    // finally statement closes the dstore and release the exclusivity if throwing an exception
                    throw new Exception(
                              string.Format("Exception occured when dropping lock records. | {0}", dropEx.Message)
                              );
                }
                finally {
                    try {
                        // write changes
                        dstore.Commit();
                    }
                    catch (Exception commitEx) {
                        // finally statement closes the dstore and release the exclusivity if throwing an exception
                        throw new Exception(
                                  string.Format("Exception occured when commiting released locks. | {0}", commitEx.Message)
                                  );
                    }
                }
            }
        }