Bug #66411

New locking API exceptions too generic

Added by Mathias Brodala over 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Must have
Category:
Miscellaneous
Target version:
Start date:
2015-04-14
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Stabilization Sprint

Description

The new locking API currently only uses RuntimeException to hint at errors during lock acquisition.

While this already has the disadvantage of catching other @RuntimeException@s the issue becomes rather clear with the non-blocking example:

try {
  $result = $locker->acquire(LockingStrategyInterface::LOCK_CAPABILITY_SHARED | LockingStrategyInterface::LOCK_CAPABILITY_NOBLOCK);
catch (\RuntimeException $e) {
  if ($e->getCode() === 1428700748) {
    // some process owns the lock, let's do something else meanwhile
  }
}

This requires knowing about this special case and knowing the magic number here. A dedicated exception would make this clearer.


Related issues

Follows TYPO3 Core - Feature #47712: Refactor Locking Closed 2013-02-08

Associated revisions

Revision f51c1996 (diff)
Added by Mathias Brodala over 4 years ago

[FOLLOWUP][TASK] Add meaningful exceptions to new locking API

This adds dedicated exceptions to the new locking API which
vastly simplifies usage workflows.

Since the new API was not yet released, this is a non-breaking
change.

Resolves: #66411
Related: #47712
Releases: master
Change-Id: Iae44eaa121562469b64222f5837f7a48e6d9fc14
Reviewed-on: http://review.typo3.org/38683
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Jigal van Hemert <>
Tested-by: Jigal van Hemert <>

History

#1 Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#2 Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#3 Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#4 Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#5 Updated by Gerrit Code Review over 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#6 Updated by Gerrit Code Review over 4 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#7 Updated by Gerrit Code Review over 4 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#8 Updated by Gerrit Code Review over 4 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/38683

#9 Updated by Anja Leichsenring over 4 years ago

  • Sprint Focus set to Stabilization Sprint

#10 Updated by Mathias Brodala over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 50 to 100

#11 Updated by Riccardo De Contardi almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF