Stopping a Thread (where I don't have control of run)

Is there any way to stop a thread whose run method simply calls a method of another class?
For example:
public class myThread extends Thread
  private String className = ...;
  public void run()
    // get className's "main" method and run it

Actually...Smarsh is right. This is the correct way
to stop a thead....stop() is deprecated because it can
cause a deadlock condition. So, in run(), if you
defined a boolean like "bStopThread" run would look
like this:
public void run()  {
if(bStopThread)
return;
// if we drop here...this is the rest of our run
un code
Yeah, I get that's how you should stop a thread...
Let me rephrase the question a little. Say the thread's run method looks similar to this:
public void run()
  if (stopped)
    return;
  someOtherClass.aMethod();
}Once it's in aMethod, I have to let it run until it's done, right? There's no other way to stop a thread other than checking a stop condition?

Similar Messages

  • Is there a way to move music I had on my iPhone 4 to my new macbook air, using iTunes it seems to want to synch to iTunes library where I don't have any music stored?

    is there a way to move music I had on my iPhone 4 to my new macbook air, using iTunes it seems to want to synch to iTunes library where I don't have any music stored?

    Hello KM47,
    It soundsl ike you are needing to copy your iTunes purchases to your computer rather than sync it at this point. You can use the following article to transfer your purchases with the following article:
    iTunes Store: Transferring purchases from your iOS device or iPod to a computer
    http://support.apple.com/kb/ht1848
    If you have your library stored on another computer, you can also copy the library to the new MacBook Air with this article:
    iTunes: How to move your music to a new computer
    http://support.apple.com/kb/ht4527
    Thank you for using Apple Support Communities.
    All the very best,
    Sterling

  • Can I rent a movie in iTunes and then watch it in my car where I don't have an Internet connection?

    Just wondering how to download a movie on the iPad and then take it in the car or on a plane and watch it... Is it possible to rent a movie on iTunes and then watch it elsewhere, where I don't have access to Internet?

    Absolutely.  You can rent or buy a movie in iTunes and once downloaded to your iPad, watch it without internet access.  You can do this directly on your iPad.  Open iTunes on your iPad.  Browse, then buy or rent what you want.  Once downloaded, your purchase will appear in your Video App, which was preloaded on your iPad.

  • Does Apple have anything like Microsoft's OneNote (where I don't have to use a cloud server)?

    Does Apple have anything like Microsoft's OneNote (where I don't have to use a cloud server)?

    Rob, others,
    For CS6 (as for CS5 and CS5.5), registration with Adobe forms part of activation, so none of them can be run without Adobe having your registration number.
    So they must have it, and you must be able to get it, through your Adobe ID, or if that has changed through some other information such as name, email address, or something.
    You should be able to get help one of these places if needed,
    Serial number and activation support (non-CC, chat open between 5AM and 7PM PST/PDT on workdays)
    http://helpx.adobe.com/x-productkb/global/service1.html
    Adobe ID and registration support (non-CC, chat open between 5AM and 7PM PST/PDT on workdays)
    http://helpx.adobe.com/x-productkb/global/service-c1.html
    Adobe Support (phone),
    http://helpx.adobe.com/adobe-connect/adobe-connect-phone-numbers.html
    or I can alert a forum staff friend that may alert the right someone to deal with it.

  • I'm not able to close the filefox or any tab in Firefox 28.0 v for sometime. It seems that i don't have control over it.

    I'm not able to close the filefox or any tab in Firefox 28.0 v for sometime. It seems that i don't have control over it. Also if i'm watching any video not able pause it or move forward or use full screen.
    While as i'm opening the same like in IE itz working fine.
    I'm using firefox from past 5 years. Can u fix it as i temporary moved to chrome.

    hello, i'm not sure what filefox is - can you try to replicate this behaviour when you launch firefox in safe mode once? if not, maybe an addon is interfering here...
    [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]]

  • Replacing previous copy stopped with..."don't have permission to open..."

    main acct on macosx is having trouble with safari..new window opens with no browsing space to type only says "untitled"
    So downloaded FF on other accounts of laptop. Now want it on main account so downloaded it but don't know..ca'n t see if one has been downloaded before for this acct....So, when download says "do you want to replace?" Yes___Then reply comes to me that I don't have permission for some.....?.

    If you get an error message that you do not have sufficient permissions or if you have problems with updating then easiest is to download the full version and trash the currently installed version to do a clean install of the new version.
    Download a new copy of the Firefox program and save the DMG file to the desktop
    * Firefox 4.0.x: http://www.mozilla.com/en-US/firefox/all.html
    * Trash the current Firefox application to do a clean (re-)install
    * Install the new version that you have downloaded
    Your profile data is stored elsewhere in the [http://kb.mozillazine.org/Profile_folder_-_Firefox Firefox Profile Folder], so you won't lose your bookmarks and other personal data.

  • 10.7.4 in Software update, 'don't have permission', cannot run combo client

    Software Update says that 10.7.4 is available for download. I attempted to install it and type in all my usual password info, but the system says:
    'The update “Mac OS X Update” can’t be saved. You don't have permission.'
    I then downloaded the combo client and attempted to run the package. It stated that 'The installation failed. The Installed can't create the folder "/var/folders/z7.....etc......'
    Not exactly sure what is happening. I've tried repairing permissions, and it did not work. I am the only user on the account. Any ideas?

    Called Apple Support. They had me create a new Admin account and install the update. Looks like the update is downloading fine now. They scheduled a call back to help me repair my original Admin account because they said it's now screwed up.

  • Does anyone know why there would be slight latency using a digital out (Toslink w/adaptor) to my amp, where I don't have latency with an analogue cable? Is it the amp that is causing the latency?

    Recenty used a Macbook Pro with analogue out to my amp and there was no latency at all. Bought a new iMac and got a Toslink cable with adaptor and connected to same amp. There is slight latency using the digital out! Can anyone explain why? I don't really want to go back to using the digital cable because I have the surround sound setup that works well with the optical cable.

    error: I don't really want to go back to using the ANALOGUE cable....

  • I keep getting the FIrefox has stopped working error message, i don't have firefox installed, i have installed then removed firefox but it persists.

    I do not use firefox, i have installed, and then uninstalled firefoxx to resolve this issue, removing all settings, i have cleared all browsing data from all browsers, the error messages are BEX. Its almost as if it keeps trying to install itself and failing.

    Screenshot.

  • TS1702 How can I edit my credit card information to where I don't have to provide any credit card to the apps.

    I was told that we can now update our iTunes information. I signed on, but I can't find where I can edit the credit card info. Please help.

    Settings/iTunes & App Store
    Then click your Apple ID name
    Select View Apple ID
    logon
    Click Payment Information

  • Asking for serial number where i don't have one.

    I've purchased month-to-month plan and now they asking me to renew my subscription, however when i tried to do so, they're asking for a serial number!

    Sign in, activation, or connection errors | CS5.5 and later
    Mylenium

  • Tutorials point to opening window bullets - I don't have that window running Muse CC 2014.3

    Hi
    I'm new to muse but I'm a front end developer and I wanted to see if muse could speed up workflow when creating some of our one off landing pages.  I'm trying to add a list to a text area and all the tutorials point to opening Window > bullet but I do not have bullet on my window menu.  How could this be?
    Thanks,
    Amanda

    Hello,
    Release version v7.4 Build 30, CL 784238 is not the latest version and also its not Muse CC 2014.3 version.
    As you are launching an old version of Muse you will not get the option for bullets under windows.
    Please make sure you are launching Muse CC2014.3. To ensure that Please launch Creative Cloud Application > go to apps tab and Launch Muse CC 2014.3 from there.
    If its not upto date please make sure to Update it.
    Regards
    Vivek

  • I have set DELETE preferences but still don't have control!

    I've read various posts and know exactly how to set my delete preferences to NEVER. Preferences/Accounts etc. So I have my trash set to never delete (vs one day, one week, one month)... but I only have the previous month's deleted email in the trash folder. Every day I check, and the corresponding day from a month ago is now the last date mail is saved. Anyone know what gives? The is the same on my home computer, and when I access Mac Mail from my computer at work.

    Be wary of any advice I give about .mac, as I haven't used it ...
    As far as I know, ,mac uses the imap protocol, so your mail messages are stored on a server (.mac). The deletion control settings you refer to are for mail stored in local mailboxes on your computer. I imagine it is possible to make similar settings in your account on the .mac server. Alternatively, download the mail from the server to your computer and the local settings will work - but then you won't have access to undeleted mail both at work and at home.
    AK

  • Launch Firefox & message "The update could not be installed. Please make sure there are no other copies of Firefox running on your computer & then re-start Firefox again, But I don't have other copies running.

    Launch Firefox & message says update couldn't be installed. Check no other copies running, but none are

    Upgrade your browser to Firefox 8 and check
    * getfirefox.com

  • How to stop a thread without the deprecated Thread.stop() method?

    Hi,
    I am writting a server application that launches threads, but the run() implementation of these threads are not written by me (i.e. i have no control over them): they are third-party programs. That's why i could not use the well known Java tutorial way to stop a thread (i.e. with a global variable that indicates the thread state).
    I would like my server to be able to stop these threads at any time, but without using the deprecated Thread.stop() method.
    Any ideas ?
    Thanks in advance,
    Fabien

    Thanks Pandava!
    I was arrived at the same conclusion... As to me, it is a very bad issue, because it means for example that a servlet server can not stop any servlet it launches (especially for preventing infinite loops).
    If i want to be strictly JDK 1.4 compliant, i should not use Thread.stop(). But if i don't use it, i don't have any ideas of how stop a thread that i don't control...

Maybe you are looking for

  • DIV scrollbar not working in IE 6

    Posted this yesterday with no response. Since then I've discovered it seems to be an IE 6 problem. Suggestions? Using a DIV tag set to overflow. I have it so the scroll bars show up if more text is addded. Works fine on my three PC's with IE and FF,

  • IPhone 5 keep crashing after the new update

    my iPhone keeps crashing after updating to 8.1.1. This is very frustrating now

  • IPod Shuffle Does Not Support Apple LossLess?

    i ripped some songs in apple lossless from my cd collections. then i tried to upload those songs to my old iPod Shuffle. But it was denied, and i have to check the "covert higher bit rate songs to 128kbps" check box. so ipod shuffle doesn't not suppo

  • Possible to switch RAM out of old Titanium PB into a G4 iMac (2003-ish)?

    I have two computers. I want to know if it's possible to take the RAM chip out of one and put it into the other. The "donor" computer is an old Titanium Powerbook G4. It has a 128mb SDRAM chip built in, and a 256 SDRAM that was added later. The "reci

  • Sony GV-HD700 issue

    I'm having issues with FCP using the Sony GV-HD700 for video playback. I cannot get it to run as an HD playback device. DV seems to work ok, but the options for HDV are all grayed out. My sequence preset is: HDV-1080i60 Capture preset is: HDV Device