DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Attributes | List of all members
Deveel.Data.Transactions.LockHandle Class Reference
Inheritance diagram for Deveel.Data.Transactions.LockHandle:

Public Member Functions

void CheckAccess (ILockable lockable, AccessType accessType)
 
bool IsHandled (ILockable lockable)
 
void Dispose ()
 

Package Functions

 LockHandle (int lockCount)
 
void AddLock (Lock @lock)
 
void Release ()
 

Properties

bool IsUnlocked [get, set]
 

Private Attributes

Lock[] locks
 
int lockIndex
 

Detailed Description

Definition at line 22 of file LockHandle.cs.

Constructor & Destructor Documentation

Deveel.Data.Transactions.LockHandle.LockHandle ( int  lockCount)
inlinepackage

Definition at line 26 of file LockHandle.cs.

26  {
27  locks = new Lock[lockCount];
28  lockIndex = 0;
29  IsUnlocked = false;
30  }

Member Function Documentation

void Deveel.Data.Transactions.LockHandle.AddLock ( Lock lock)
inlinepackage

Definition at line 34 of file LockHandle.cs.

void Deveel.Data.Transactions.LockHandle.CheckAccess ( ILockable  lockable,
AccessType  accessType 
)
inline

Definition at line 48 of file LockHandle.cs.

48  {
49  for (int i = locks.Length - 1; i >= 0; --i) {
50  var tableLock = locks[i];
51  if (tableLock.Lockable == lockable) {
52  tableLock.CheckAccess(accessType);
53  return;
54  }
55  }
56 
57  throw new Exception("The given object was not found in the lock list for this handle");
58  }
void CheckAccess(AccessType accessType)
Definition: Lock.cs:101
void Deveel.Data.Transactions.LockHandle.Dispose ( )
inline

Definition at line 69 of file LockHandle.cs.

69  {
70  if (!IsUnlocked) {
71  Release();
72 
73  // TODO: report the situation: there should not be
74  // a call to Release() at this point...
75 
76  locks = null;
77  }
78  }
bool Deveel.Data.Transactions.LockHandle.IsHandled ( ILockable  lockable)
inline

Definition at line 60 of file LockHandle.cs.

60  {
61  for (int i = locks.Length - 1; i >= 0; i--) {
62  if (locks[i].Lockable == lockable)
63  return true;
64  }
65 
66  return false;
67  }
void Deveel.Data.Transactions.LockHandle.Release ( )
inlinepackage

Definition at line 38 of file LockHandle.cs.

38  {
39  if (!IsUnlocked) {
40  for (int i = locks.Length - 1; i >= 0; --i) {
41  locks[i].Release();
42  }
43 
44  IsUnlocked = true;
45  }
46  }

Member Data Documentation

int Deveel.Data.Transactions.LockHandle.lockIndex
private

Definition at line 24 of file LockHandle.cs.

Lock [] Deveel.Data.Transactions.LockHandle.locks
private

Definition at line 23 of file LockHandle.cs.

Property Documentation

bool Deveel.Data.Transactions.LockHandle.IsUnlocked
getsetprivate

Definition at line 32 of file LockHandle.cs.


The documentation for this class was generated from the following file: