iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
89.29k stars 26.41k forks source link

Implicit Lock pattern #1300

Open iluwatar opened 4 years ago

iluwatar commented 4 years ago

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.
djeong20 commented 2 years ago

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

iluwatar commented 2 years ago

Ok @djeong20

natashasrivastava commented 1 year ago

Hey @iluwatar Can you assign this to me?

iluwatar commented 1 year ago

Done @natashasrivastava, good luck

mohanaraosv commented 1 year ago

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

iluwatar commented 1 year ago

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

stale[bot] commented 1 year ago

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.

Chant3ll3 commented 10 months ago

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

stale[bot] commented 8 months ago

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.