Meaningless Drivel is fun!*
The moose likes Threads and Synchronization and the fly likes how can i stop my thread without using .stop()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "how can i stop my thread without using .stop()?" Watch "how can i stop my thread without using .stop()?" New topic
Author

how can i stop my thread without using .stop()?

F.David Ang
Greenhorn

Joined: Mar 30, 2013
Posts: 2
hey, i am having problems in stopping a thread in playing music. i tried searching for a way to stop without using .stop() (since is is deprecated), but the stuff i found does not work with my code... sorry i'm a newbie here


I use playmusic player = new playmusic("song.mp3"); and player.start(); to start playing the song... but i dont know any other way on how to stop it besides .stop()... any ideas?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3948
    
  17

The key is to use APIs and methods that can be interrupted. I don't know anything about the AdvancedPlayer, but does it have a stop, cancel, or interrupt? If so you should Create a method which Calls it. If not, then think about adding one, because without a safe way to stop the music there is no safe way to stop the thread safely.


Steve
F.David Ang
Greenhorn

Joined: Mar 30, 2013
Posts: 2
thanks for the answer. i'll try to search on about what you said
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how can i stop my thread without using .stop()?
 
Similar Threads
using Midi player for interactive app - makes horrible clicking sound
Dynamic Switching between two are more methods
Struts2 Play audio file
Getting different output in a Spring project
Problem stopping audio in using sun.audio package