1 | <?php |
||
19 | class MutexFabric |
||
20 | { |
||
21 | protected $defaultLockImplementorName; |
||
22 | protected $implementors = array(); |
||
23 | protected $mutexes = array(); |
||
24 | |||
25 | /** |
||
26 | * @param string $lockImplementorName |
||
27 | * @param $lockImplementor |
||
28 | */ |
||
29 | public function __construct($lockImplementorName, LockInterface $lockImplementor) |
||
33 | |||
34 | /** |
||
35 | * |
||
36 | * @param string $name |
||
37 | * @param LockInterface $implementor |
||
38 | * @throws MutexException |
||
39 | */ |
||
40 | public function registerLockImplementor($name, LockInterface $implementor) |
||
52 | |||
53 | /** |
||
54 | * @param string $registeredLockImplementorName |
||
55 | */ |
||
56 | public function setDefaultLockImplementorName($registeredLockImplementorName) |
||
60 | |||
61 | public function getDefaultLockImplementorName() |
||
65 | |||
66 | /** |
||
67 | * Create and/or get mutex |
||
68 | * |
||
69 | * @param string $name |
||
70 | * @param string $registeredLockImplementorName |
||
71 | * @return Mutex |
||
72 | */ |
||
73 | public function get($name, $registeredLockImplementorName = null) |
||
85 | |||
86 | /** |
||
87 | * @param string $name |
||
88 | * @param string $registeredLockImplementorName |
||
89 | */ |
||
90 | protected function createMutex($name, $registeredLockImplementorName) |
||
94 | } |
||
95 |