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

  • SEARCH
  • Home
  • 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 8718675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:36:12+00:00 2026-06-13T06:36:12+00:00

I want a Mutex in Java which let me to wait on it in

  • 0

I want a Mutex in Java which let me to wait on it in a thread and release it in another thread. I know that I can use a Semaphore with capacity of 1 but the problem is that the “acquire()” method throws “InterruptedException”. Is there any special synchronization way for this purpose in Java?

  • 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-06-13T06:36:13+00:00Added an answer on June 13, 2026 at 6:36 am

    Luckily, Semaphore provides this method for you 🙂

    public void acquireUninterruptibly()

    Acquires a permit from this semaphore, blocking until one is
    available. Acquires a permit, if one is available and returns
    immediately, reducing the number of available permits by one.

    If no permit is available then the current thread becomes disabled for
    thread scheduling purposes and lies dormant until some other thread
    invokes the release() method for this semaphore and the current thread
    is next to be assigned a permit.

    If the current thread is interrupted while waiting for a permit then
    it will continue to wait, but the time at which the thread is assigned
    a permit may change compared to the time it would have received the
    permit had no interruption occurred. When the thread does return from
    this method its interrupt status will be set.

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

Sidebar

Related Questions

Is it true that a mutex can only be released from the thread that
I want to wait 1.5 seconds in a boost thread. Using boost::xtime I can
want to have a Hyperlink-Button in a gridView in which I can display a
I'm re-working a Java executable that may be started multiple times, and I want
I want to generate a map of mutex elements, which probably need to be
I want some clarification regarding mutex and semaphore. My question is, What mutex actually
I want to make a windows service that monitors another windows service, and make
I want to create a thread for some db writes that should not block
https://stackoverflow.com/a/5524120/462608 If you want to call functions recursively, which lock the same mutex, then
I want to implement a mutex in Java using atomic variables. I tried implementing

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.