Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 958167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:49:12+00:00 2026-05-16T00:49:12+00:00

Guys, can anyone give a simple practical example of LockSupport & AbstractQueuedSynchronizer use? Example

  • 0

Guys, can anyone give a simple practical example of LockSupport & AbstractQueuedSynchronizer use? Example given in javadocs is quite strained.

Usage of Semaphore permits is understood by me.

Thanks for any response.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T00:49:12+00:00Added an answer on May 16, 2026 at 12:49 am

    If youre talking about using a locking mechanism (or even sync barriers) just use a java.util.concurrent.Lock. The obvious suggestion is to user a ReentrantLock which delegates to a Synch. The synch is an AQS which in turn uses LockSupport.

    Its all done under the covers for you.

    Edit:

    No let’s go over the practical uses of AbstractQueuedSynchronizer (AQS).

    Concurrency constructs though can be very different in their usage all can have the same underlying functions.

    I.e. Under some condition park this thread. Under some other condition wake a thread up.

    This is a very broad set of instructions but makes it obvious that most concurrency structures would need some common functionality that would be able to handle those operations for them. Enter AQS. There are five major synchronization barriers.

    • ReentrantLock
    • ReadLock
    • WriteLock
    • Semaphore
    • CountDownLatch

    Now, all these five structures have very different set of rules when using them. A CountdownLatch can allow many threads to run at the same time but forces one (or more) threads to wait until at least n number of threads count down on said latch.

    ReentrantLock forces only one thread at a time to enter a critical section and queues up all other threads to wait for it to completed.

    ReadLock allows any number of reading threads into the critical section until a write lock is acquiered.

    The examples can go on, but the big picture here is they all use AQS. This is because they are able to use the primitive functions that AQS offers and implements more complex functionality on top of it. AQS allows you to park unpark and wake up threads ( interruptibly if need be) but in such a way that you can support many complex functions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi guys can anyone guide me on implementation of Internationalization on Android platform. I
Hello guys can anyone help me with the issue im having with installation of
hello guys i am doing some database operations in iphone .. please can anyone
Guys, can anyone explain the following scenario: 1) Web application has module1.jar in its
Hello Guys can anyone Explain me How to add UILocalNotifications to an Array
i ran into a simple problem, which I think you guys can solve. I
can anyone here give me a view or idea on how to get the
Guys can anyone tell me why I can't remove the list-style-type from the <ul>
I'm hoping you guys can answer me a question? I've only just started out
I'm hoping you guys can help me figure out why this is happening. I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.