Skip to content

GH-2971: Add LockRegistry.executeLocked() API #8729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 11, 2023

Conversation

artembilan
Copy link
Member

Fixes #2971

  • Following best practice and well-known patterns with Jdbc, Rest or Jms templates, introduce default methods into LockRegistry interface to make it easier to perform tasks when within a lock.
  • Since all the required logic is now covered by those LockRegistry.executeLocked() methods, there is no need in the dedicated abstract WhileLockedProcessor class. Deprecated it for removal in the next version
  • Use a new LockRegistry.executeLocked() API in the FileWritingMessageHandler instead of just deprecated WhileLockedProcessor
  • To satisfy Java limitations for checked lambdas, introduce CheckedCallable and CheckedRunnable utilities similar to interfaces in the io.micrometer.observation.Observation
  • Change existing CheckedFunction to expose extra generic argument for Throwable
  • Add dedicated chapter for distributed lock into docs
  • Fix some links and typos in the docs

Fixes spring-projects#2971

* Following best practice and well-known patterns with `Jdbc`, `Rest` or `Jms` templates,
introduce `default` methods into `LockRegistry` interface to make it easier to perform
tasks when within a lock.
* Since all the required logic is now covered by those `LockRegistry.executeLocked()` methods,
there is no need in the dedicated abstract `WhileLockedProcessor` class.
Deprecated it for removal in the next version
* Use a new `LockRegistry.executeLocked()` API in the `FileWritingMessageHandler`
instead of just deprecated `WhileLockedProcessor`
* To satisfy Java limitations for checked lambdas, introduce `CheckedCallable` and `CheckedRunnable` utilities
similar to interfaces in the `io.micrometer.observation.Observation`
* Change existing `CheckedFunction` to expose extra generic argument for `Throwable`
* Add dedicated chapter for distributed lock into docs
* Fix some links and typos in the docs
Co-authored-by: Gary Russell <grussell@vmware.com>
@garyrussell garyrussell merged commit 6b8d37b into spring-projects:main Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add a LockTemplate to simplify working with distributed Locks in Spring Integration
2 participants