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 5839583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:36:16+00:00 2026-05-22T11:36:16+00:00

Hello there good poeple, I need some help. I’m writing a music player which

  • 0

Hello there good poeple, I need some help.

I’m writing a music player which streams music from the web. If I pres the play button before the music is done buffering I want it to wait.

I tried doing something like this:

Object mutex = new Object();

public void main() {
    startStreaming();
    mutex.notify();
}

private void onClickPlayButton() {
    mutex.wait();
}

The problem is that is the playButton is not pressed the mutex.notify() if throws a “llegalMonitorStateException“. How do you normally solve problems like this?

EDIT To make clear. My question is: How do I make the button wait for the “startStreamning” method to finish?

  • 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-22T11:36:17+00:00Added an answer on May 22, 2026 at 11:36 am

    According to the JavaDoc,

    IllegalMonitorStateException is thrown
    “to indicate that a thread has
    attempted to wait on an object’s
    monitor or to notify other threads
    waiting on an object’s monitor without
    owning the specified monitor.”

    In order to call mutex.wait() or mutex.notify(), the calling thread must own a lock on object mutex.

    This exception is thrown if you call it without a preceding synchronized (mutex) { }

    Check out the nice animation of wait and notify in this link : How do wait and notify really work?

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

Sidebar

Related Questions

Hello and good day to you. Situation: For some reason, from time to time
Hello there Stack Overflow, I hope you'll help me with my very first question
Hello and thank for looking at my question. I'm in need to grab some
Hello Guys! I am going to write website crawler, which starts from root address
hello is there an good utility or package that handles git folder download ?
is there any good way to remove everything from a string except the content
there is a file, its name contain empty space. ex) hello I am good.zip
Why hello there Stackoverflow, I have a nutcracker for ya, is there an good
Hello there i've finally made a good perfect language system and now am trying
Hello people I need help please. Here's my code. In here is a list

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.