---
title: "Discussion on \"How to Use Locks in Multi-Threaded Java Program\" | Hashnode"
description: "Discussion on \"How to Use Locks in Multi-Threaded Java Program\". 1. Exclusive Lock(ReentrantLock): Only one thread can acquire the lock at a time.\npackage org.example.concurrency;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.locks"
url: "https://hashnode.com/posts/how-to-use-locks-in-multi-threaded-java-program/69c0822fd9da55a9a5fd9f82"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Use Locks in Multi-Threaded Java Program](https://bikash8848.hashnode.dev/how-to-use-locks-in-multi-threaded-java-program?utm_source=hashnode&utm_medium=feed)

1\. Exclusive Lock(ReentrantLock): Only one thread can acquire the lock at a time. package org.example.concurrency; import java.util.ArrayList; import java.util.List; import java.util.concurrent.locks

Mar 22 · 3 min read · bikash8848.hashnode.dev  
Read the article

-   [#concurrency](https://hashnode.com/tag/concurrency)
-   [#java](https://hashnode.com/tag/java)
-   [#synchronzation](https://hashnode.com/tag/synchronzation)
-   [#lock](https://hashnode.com/tag/lock)
-   [#multithreading](https://hashnode.com/tag/multithreading)
-   [#reentrantlock](https://hashnode.com/tag/reentrantlock)

## Written by

[Bikash Mainali](https://hashnode.com/@bikash8848)

@bikash8848

  
[View profile](https://hashnode.com/@bikash8848)

Software Engineer

Experienced Java/JavaScript full-stack developer over 6 years of extensive expertise serving key role on elite technical teams developing enterprise software for healthcare, apple ad-platform, banking, and e-commerce. Adaptable problem-solver with high levels of skill in Groovy, Java, Spring, Spring Boot, Hibernate, JavaScript, TypeScript, Angular, Node, Express, React, MongoDB, IBM DB2, Oracle, PL/SQL, Docker, Kubernetes, CI/CD pipelines, AWS, Micro-service and Agile/Scrum. Strong technical skills paired with business-savvy UI design expertise. Personable team player with experience collaborating with diverse cross-functional teams.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
