Skip to content

Commit 40684a5

Browse files
authored
Merge pull request #18080 from nextcloud/enhancement/noid/add-timeout
adding timeout param
2 parents 4bec80e + 78f00f8 commit 40684a5

3 files changed

Lines changed: 93 additions & 0 deletions

File tree

lib/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@
365365
'OCP\\LDAP\\ILDAPProviderFactory' => $baseDir . '/lib/public/LDAP/ILDAPProviderFactory.php',
366366
'OCP\\Lock\\ILockingProvider' => $baseDir . '/lib/public/Lock/ILockingProvider.php',
367367
'OCP\\Lock\\LockedException' => $baseDir . '/lib/public/Lock/LockedException.php',
368+
'OCP\\Lock\\ManuallyLockedException' => $baseDir . '/lib/public/Lock/ManuallyLockedException.php',
368369
'OCP\\Lockdown\\ILockdownManager' => $baseDir . '/lib/public/Lockdown/ILockdownManager.php',
369370
'OCP\\Log\\IFileBased' => $baseDir . '/lib/public/Log/IFileBased.php',
370371
'OCP\\Log\\ILogFactory' => $baseDir . '/lib/public/Log/ILogFactory.php',

lib/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
394394
'OCP\\LDAP\\ILDAPProviderFactory' => __DIR__ . '/../../..' . '/lib/public/LDAP/ILDAPProviderFactory.php',
395395
'OCP\\Lock\\ILockingProvider' => __DIR__ . '/../../..' . '/lib/public/Lock/ILockingProvider.php',
396396
'OCP\\Lock\\LockedException' => __DIR__ . '/../../..' . '/lib/public/Lock/LockedException.php',
397+
'OCP\\Lock\\ManuallyLockedException' => __DIR__ . '/../../..' . '/lib/public/Lock/ManuallyLockedException.php',
397398
'OCP\\Lockdown\\ILockdownManager' => __DIR__ . '/../../..' . '/lib/public/Lockdown/ILockdownManager.php',
398399
'OCP\\Log\\IFileBased' => __DIR__ . '/../../..' . '/lib/public/Log/IFileBased.php',
399400
'OCP\\Log\\ILogFactory' => __DIR__ . '/../../..' . '/lib/public/Log/ILogFactory.php',
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php declare(strict_types=1);
2+
3+
4+
5+
/**
6+
* This file is licensed under the Affero General Public License version 3 or
7+
* later. See the COPYING file.
8+
*
9+
* @author Maxence Lange <[email protected]>
10+
* @copyright 2019, Maxence Lange <[email protected]>
11+
* @license GNU AGPL version 3 or any later version
12+
*
13+
* This program is free software: you can redistribute it and/or modify
14+
* it under the terms of the GNU Affero General Public License as
15+
* published by the Free Software Foundation, either version 3 of the
16+
* License, or (at your option) any later version.
17+
*
18+
* This program is distributed in the hope that it will be useful,
19+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+
* GNU Affero General Public License for more details.
22+
*
23+
* You should have received a copy of the GNU Affero General Public License
24+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
25+
*
26+
*/
27+
28+
29+
namespace OCP\Lock;
30+
31+
32+
/**
33+
* Class ManuallyLockedException
34+
*
35+
* @package OCP\Lock
36+
* @since 18.0.0
37+
*/
38+
class ManuallyLockedException extends LockedException {
39+
40+
41+
/**
42+
* owner of the lock
43+
*
44+
* @var string|null
45+
*/
46+
private $owner = null;
47+
48+
/**
49+
* estimated timeout for the lock
50+
*
51+
* @var int
52+
* @since 18.0.0
53+
*/
54+
private $timeout = -1;
55+
56+
57+
/**
58+
* ManuallyLockedException constructor.
59+
*
60+
* @param string $path locked path
61+
* @param \Exception|null $previous previous exception for cascading
62+
* @param string $existingLock
63+
* @param string|null $owner
64+
* @param int $timeout
65+
*
66+
* @since 18.0.0
67+
*/
68+
public function __construct(string $path, \Exception $previous = null, ?string $existingLock = null, ?string $owner = null, int $timeout = -1) {
69+
parent::__construct($path, $previous, $existingLock);
70+
$this->owner = $owner;
71+
$this->timeout = $timeout;
72+
}
73+
74+
75+
/**
76+
* @return int
77+
* @since 18.0.0
78+
*/
79+
public function getTimeout(): int {
80+
return $this->timeout;
81+
}
82+
83+
/**
84+
* @return string|null
85+
* @since 18.0.0
86+
*/
87+
public function getOwner(): ?string {
88+
return $this->owner;
89+
}
90+
91+
}

0 commit comments

Comments
 (0)