1
0

ManuallyLockedException.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Lock;
  8. /**
  9. * Class ManuallyLockedException
  10. *
  11. * @since 18.0.0
  12. */
  13. class ManuallyLockedException extends LockedException {
  14. /**
  15. * owner of the lock
  16. *
  17. * @var string|null
  18. */
  19. private $owner = null;
  20. /**
  21. * estimated timeout for the lock
  22. *
  23. * @var int
  24. * @since 18.0.0
  25. */
  26. private $timeout = -1;
  27. /**
  28. * ManuallyLockedException constructor.
  29. *
  30. * @param string $path locked path
  31. * @param \Exception|null $previous previous exception for cascading
  32. * @param string $existingLock
  33. * @param string|null $owner
  34. * @param int $timeout
  35. *
  36. * @since 18.0.0
  37. */
  38. public function __construct(string $path, ?\Exception $previous = null, ?string $existingLock = null, ?string $owner = null, int $timeout = -1) {
  39. parent::__construct($path, $previous, $existingLock);
  40. $this->owner = $owner;
  41. $this->timeout = $timeout;
  42. }
  43. /**
  44. * @return int
  45. * @since 18.0.0
  46. */
  47. public function getTimeout(): int {
  48. return $this->timeout;
  49. }
  50. /**
  51. * @return string|null
  52. * @since 18.0.0
  53. */
  54. public function getOwner(): ?string {
  55. return $this->owner;
  56. }
  57. }