java-design-patterns icon indicating copy to clipboard operation
java-design-patterns copied to clipboard

Implicit Lock pattern

Open iluwatar opened this issue 5 years ago • 14 comments

Description

The Implicit Lock design pattern ensures that only one thread can execute a particular section of code at a time without requiring explicit lock management by the developer. This is particularly useful in environments where multiple threads need to interact with shared resources, preventing data corruption and ensuring consistency. The pattern leverages synchronized methods or blocks to manage concurrent access automatically, simplifying the code and reducing the likelihood of concurrency-related bugs.

Main Elements:

  1. Synchronization: Use of synchronized methods or blocks to control access to critical sections of code.
  2. Automatic Lock Management: The pattern abstracts lock management away from the developer, reducing the risk of errors.
  3. Concurrency Control: Ensures that only one thread can execute the synchronized section at a time, preventing race conditions.

References:

Acceptance Criteria:

  1. Implement the Implicit Lock design pattern using synchronized methods or blocks in a new module.
  2. Ensure thorough unit tests are created to validate the concurrency control and proper functioning of the pattern.
  3. Update documentation to include an explanation of the Implicit Lock pattern, how it is implemented, and example use cases.

iluwatar avatar Jul 07 '20 17:07 iluwatar

Hi, I would like to work on this issue. Can you assign it to me? Thanks!

djeong20 avatar Oct 13 '21 20:10 djeong20

Ok @djeong20

iluwatar avatar Oct 16 '21 16:10 iluwatar

Hey @iluwatar Can you assign this to me?

natashasrivastava avatar Oct 08 '22 15:10 natashasrivastava

Done @natashasrivastava, good luck

iluwatar avatar Oct 08 '22 15:10 iluwatar

I believe this is EIP - we are placing them in separate repositories please keep that in mind https://github.com/iluwatar/java-design-patterns/issues/2026

mohanaraosv avatar Oct 10 '22 06:10 mohanaraosv

It's not. Belongs to patterns of enterprise application architecture book.

iluwatar avatar Oct 10 '22 15:10 iluwatar

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 28 '22 12:11 stale[bot]

Hi @iluwatar! I want to work on this issue, could you assign it to me please?

Chant3ll3 avatar Oct 21 '23 04:10 Chant3ll3

This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 21 '23 15:12 stale[bot]