Locks In Db4o

In db4o locks can be implemented with the help of Semaphores. Though you cannot implement page or cluster locking, you can still vary the range of locking by using different semaphore names. For example:

  1. The following semaphore will lock all the objects of a class:

    .NET:

    extObjectContainer.SetSemaphore(typeof(Pilot).Name, 3000)

  2. This semaphore will lock a single object

    .NET: 

    extObjectContainer.SetSemaphore("LOCK_"+objectContainer.Ext().GetID(pilot), 3000)