wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.BusyLockManager.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.BusyLockManager.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/lib/persistence/class.LockManager.php");
20 
21 /**
22  * @class BusyLockManager
23  * @ingroup Persistence
24  * @brief BusyLockManager acts as if half of the resources are locked.
25  * Use this to simulate heavy concurrency.
26  *
27  * @author ingo herwig <ingo@wemove.com>
28  */
30 {
31  /**
32  * @see LockManager::aquireLockImpl();
33  */
34  function aquireLockImpl($authUser, $session, $oid, $lockDate) {}
35  /**
36  * @see LockManager::releaseLockImpl();
37  */
38  function releaseLockImpl($authUser, $session, $oid) {}
39  /**
40  * @see LockManager::releaseAllLocksImpl();
41  */
42  function releaseAllLocksImpl($authUser, $session) {}
43  /**
44  * @see LockManager::getLockImpl();
45  */
46  function getLockImpl($oid)
47  {
48  if (rand(0,1) > 0.5)
49  return null;
50  else
51  {
52  $lockDate = date("Y-m-d H:i:s", mktime(date("H"), date("i")-1, date("s"), date("m"), date("d"), date("Y"))); // one minute ago
53  return array('oid' => $oid, 'userid' => 0, 'login' => 'BusyLockManager', 'since' => $lockDate, 'sessid' => uniqid(""));
54  }
55  }
56 }
57 ?>
releaseAllLocksImpl($authUser, $session)
BusyLockManager acts as if half of the resources are locked. Use this to simulate heavy concurrency...
LockManager is used to handle lock requests on objects.
aquireLockImpl($authUser, $session, $oid, $lockDate)
releaseLockImpl($authUser, $session, $oid)