What does Future.cancel(true) do?

Hi, I have some (a dozen) Callable object which are submitted to the ExecutorService ( talking about jdk5.0 concurrent package), and I want that the threads executing those Callable task last for not so much time: invoking cancel(true) on a Future object returned, will cause the Callable task to end immediatly (or quite immediatly) ?? Or does it depend on what the Callable do inside its call() method?
I asked that question because I would like to stop tasks if they don't end within a certain amount of time, and up to now I didn't find a solution for my problem since what the Callable object do inside their call() method is launching a 3rd-party" algorithm with some parameters.
thanks
ciao
alessio

I've not used the concurrent package in 1.5, but I've used util.concurrent a fair bit in the past.... However, looking at the 1.5 javadocs, I interpret the description for FutureTask#cancel(boolean) as meaning if you call it with "true", and the FutureTasks Callable is currently being executed, the Thread executing it will be interrupted.
Now, whether or not this actually causes your task to actually finish is another story: It depends on what the task does.
If the task is doing something which will stop when interrupted (e.g, waiting on a monitor, doing a NIO select, whatever), then (unless the task explicitly catches InterruptedExceptions and continues anyway...) your task should stop.
However, if its doing something which isn't affected by interrupts (e.g, good 'ole blocking IO) - then you are out of luck.
This is very similar to a question which comes up quite a bit on these forums - "how do I stop a thread performing some task after a certain amount of time". Have a search around the forums - there are probably some much better answers than mine around.
Dave

Similar Messages

  • Truthful about damage, our MacBook air repair order has been canceled. What does this mean?

    My husband spilled a beverage on my Air, and we promptly took it to our local Apple store. I am fully aware that AppleCare does not cover water damage. However, while at the store the genius bar folks informed us (in writing) that they could make a one time exception which reduced the tier four damage from almost $700, to $0. Needless to say this thrilled us, as we were completely prepared to replace the unit out if pocket without argument. Later in the evening I signed into my apple account just to see if it had been mailed to the depot. Apple canceled the repair. I would think postponing it, and then calling us to say "hey, we will need payment for this" would have happened before canceling the repair. I need this machine working ASAP for my work, so to have it canceled during memorial day weekend is very bad for us.
    Basic info:
    1. We fully disclosed that there is water damage
    2. In writing we have a CS code, and written statement "depot repair as a one time exception for customer" listed under proposed resolution
    3. Amount due $0.00
    Now, I don't mind (well, I do mind because it *****) paying for a repair due to my husbands neglect, however I wish a phone call or email communication should have been made prior to outright canceling the repair order.
    What can I do? What does the canceled order mean. we've been loyal apple customers for years, multiple computers, iPhones, I pods, and I pads. The cancellation of our repair order seems odd.

    >while at the store the genius bar folks informed us (in writing)
    Have you contacted the Genius that gave you this information for an explanation?  If his/her name is not on the written statement you received, it should be in Apple's system.
    >What can I do? What does the canceled order mean.
    >I need this machine working ASAP for my work, so to have it canceled during memorial day weekend is very bad for us.
    I would call either the Apple Store or Applecare.  They should be able to help you.
    FWIW, I agree with you 100% that you should have been contacted by Apple.
    EDIT:  Looks like you resolved this while I was typing

  • I replaced my iPhone with a Galaxy 5 and am not receiving all of my text messages. The sales person told me to remove my phone number from iTunes to stop this from happening. Is that true? What does iTunes have to do with text messages?

    I replaced my iPhone with a Samsung Galaxy5 and I am not receiving all of my text messages now. The rep at the store told me to go to iTunes and take my phone # off of the account and that would fix the problem. Is that true? What does iTunes have to do with text messages anyway?

    You need to remove your phone number from the iMessage system.
    Read here: http://support.apple.com/kb/ts5185
    ~Lyssa

  • I plugged my iphone in for the first time to my itunes account and it now reads that this device is already  associated with an apple id.  what does that mean.  i only have one apple id. and do i chose cancel or transfer?

    i plugged my iphone in for the first time to my itunes account and it now reads that this device is already  associated with an apple id.  what does that mean.  i only have one apple id. and do i chose cancel or transfer?

    Hello there, Shellywms09.
    The following Knowledge Base article points out why you are receiving that message on your iPad:
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/ht4627
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro

  • What does it take to get my service cancelled?

    I am trying to find out what it will take to get my account cancelled... I called more than a week in advance of my move to set up the cancellation of my FIOS home service and was assured that was all I needed to do; I would receive my final bill in the mail. However, a week after I moved, my account was charged and my autopay paid my bill of nearly $200 for services this month in a home I no longer live in, for an account that should no longer be active. I called and spoke with no fewer than 12 agents over that week, including someone who after 43 minutes of being passed around HUNG UP on me! Finally I spoke with someone who was helpful and said my account was deactivated, and in about 14 business days I should get a refund check in the mail. Well, three weeks later, my account has still not been cancelled and I have not gotten my refund! I just called again and spoke with an agent who told me he couldn't help me and I needed to call back another office on Monday. It has been nearly a month since I moved and this account was supposed to be cancelled and I still cannot get anyone to just stop the account! What does it take at Verizon to end my service??? 

    megan723,
    Your issue has been escalated to a Verizon agent. Please go to your profile page for the forum, and look in the middle, right at the top where you will find an area titled "My Support Cases".  You can reach your profile page by clicking on your name beside your post, or at the top left of this page underneath the title of the board.
    Under “My Support Cases” you will find a link to the private board where you and the agent may exchange information.  This should be checked on a frequent basis  as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer that solved your issue as the accepted solution.

  • What does it mean when you call someone and it goes straight to the 3 beeps to mean cancelled

    hi
    what does it mean when you call someone and it goes straight to the 3 beeps to mean cancelled? this phone doesnt even ring, it just goes straight to the BEEP-BEEP-BEEP, its an iphone 4 and on IOS7 and it was ringing eailier on in the day when i spoke to this person. it wouldn't mean i have been blocked would it?
    what does all this mean?
    thanks
    mrredrunner100

    i got my friend to message this person to see if they had the same problem, and the message went through and i think he got a reply, and all of a sudden this has started to work again (calls only) but apparently none of my messages went through that i have sent since the block activated. and they still havent even though there working again, and "apparently" a message was sent to me at 9pm today and it has never arrived. so imessage and text still isnt working, before i go asking this person about this, is this a genuine block or is there a phone problem?

  • I canceled my month to month Extension Builder plan but "Withdrawn: active on September 27, 2014 " under the product, What does this mean? Is it going to be reactivated on September 27, 2014?

    I canceled my month to month Extension Builder plan but "Withdrawn: active on September 27, 2014 " under the product, What does this mean? Is it going to be reactivated on September 27, 2014?

    I canceled my month to month Extension Builder plan but "Withdrawn: active on September 27, 2014 " under the product, What does this mean? Is it going to be reactivated on September 27, 2014?

  • MacBook pro repair cancelled? What does this mean?

    Hello!
    I got my Macbook pro to the Apple Store to get it repaired due to a logic board failure. The repair status was normal until today that shows that it is cancelled. My MacBook is a preowned Mac core 2 duo mid 2009 and it is out of warranty. what does it mean that it is cancelled?

    It is better to call AppleCare and find out.
    AppleCare: 1-800-275-2273
    Best.

  • -Dsun.lang.ClassLoader.allowArraySyntax=true what does this do?

    According to Sun's bug database - Bug# 6434149, the documented work around for loading classes using loadClass() is as follows:
    1) Add -Dsun.lang.ClassLoader.allowArraySyntax=true if you want to use a library for which you don't have the source with JDK6
    2) Change loader.loadClass( name ) to Class.forName( name, false, loader ) if you own the code.
    What does -Dsun.lang.ClassLoader.allowArraySyntax does exactly? Does it affect any other Java 1.6 existing functionalities? Is it safe to add?

    Hello Rene,
    no, it's not the same. The first one is more general, as you set the application to be unavailable before you do the upgrade. Obviously, you use it for any other maintenance task as well. We also use it to disable applications that shall only be available a few days per month.
    The second attribute is set to mark the application of being imported (also if it's the first time) and hence it won't be accessible at that moment. Furthermore, you can't execute a second update/import at that time, which would be possible if you just set the flow status to unavailable.
    -Udo

  • HT4623 I turned my Iphone 4 off. QWhen I went to turn it back on, it brought me to a silver screen that reads Iphone with no service, what does this mean? And no, my service has not been cancelled. please help?

    I turned my Iphone 4 off. When I went to turn it back on, up popped a silver screen that read Iphone with no service. My service has not been cancelled. What does this mean, please help?

    If a reset doesn't work, try and force iPad into Recovery Mode:
    1. Turn off iPad. Press and hold the Sleep/Wake button for a few seconds until the red slider appears, slide to turn off.
    2. Connect USB cable to computer
    3. Press and hold the Home button down and connect the docking end of cable to iPad
    4. Continue holding the Home button until you see the "Connect To iTune" screen
    5. Release the Home button
    6. Open iTune (make sure you have the newest version of iTune)
    7. You should see "iTunes has detected an iPad in recovery mode"
    8. Use iTune to restore iPad
    Note: You need to be patient and repeat the above many times to recover your iPad

  • What does this TJ data mean?

    Hello,
    I am implementing a PDF parser in Objective-C  (using CoreGraphics API's) that will aid in PDF search. I know that the Tj and TJ operators are used for displaying text, and that to retrieve the text information from a page I should be looking there.
    The problem comes in when there are weird operands in the TJ operator. Below is one such example:
    [<1C>]TJ
    0.7039 0 Td
    [<1D>]TJ
    What does the above highlighted red text data mean, in terms of the semantic information that it contains? During parsing, the output of the above 2 operands are the characters ˝ and ˛ respectively. Am I going to have to use the font encoding provided in the Resources dictionary of the page to decipher what these characters semantically mean?
    Thanks a lot,
    Michael

    I assume you have a copy of ISO 32000-1:2008 available, so that you are reading what is written there first before asking.
    The answer is that NOT ONLY do you need to read the font encoding information for ANY TEXT EXTRACTION, but you ALSO need to read the information from any embedded fonts for the embedded encoding information.  This is especially true for TrueType fonts vs. Type 1 fonts, and CID-based fonts.
    And don't forget ToUnicode tables!
    There is a section in ISO 32000-1 that describes the entire process of text extraction.

  • Trying to update my iPhoto to 9.5.1 and I get "Update Unavailable with This Apple ID" what does this mean and how do I fix it?

    My iPhoto currently has a circle with an 'x' through it and I can not open it or sync my photos.
    Trying to Update my iPhoto to 9.5.1 and it says "Update Unavailable with This Apple ID" because "This update is not avaialble for this Apple ID either because it was bought by a different user or the item was refunded or cancelled."
    What does this mean and how do I fix it?
    I haven't changed my Apple ID or if I bought teh original update under my parents Apple ID, how do i fix it?
    Thanks!

    What version of the OS do you have?
    Is there an iPhoto application in teh applications folder?
    LN

  • What does "Camera Profile" mean in the Camera Calibration tab in PSE 12?

    I recently made the switch to edit exclusively in Photoshop Elements 12. I need help understanding what I need to select for the "Camera Profile" drop down in the Camera Calibration tab. I shoot with a Canon Mark II. Will the camera profile selection affect my prints at all? First, what does the camera profile mean? I go back and forth between Adobe Standard and Camera Standard. Sometimes I get truer color with Camera Standard than the Adobe Standard for my outside photos. I'm so confused as to which one I should be editing with. I just want to be sure this is not going to affect my prints because I just recently ordered a print from Millers and it was saturated, shadowing and skin had orange tone. I have never had a problem with my calibration and have always ordered from Millers with no problem. This is the first print I ordered after editing exclusively with PSE 12 so I'm wondering if I have setting wrong. Thanks so much!

    Will the camera profile selection affect my prints at all?
    It will affect prints to the same extent that it affects the monitor display, but no more than that. The differences that you see in color rendering when switching between profiles will be embodied in the jpg that you eventually make for sending to the print lab, but will not in itself cause the discrepancies you describe.

  • What does "Analyze audio for flex time editing" in Garage Band? It's taking so long(3 days)! and I can't shut down my pc.

    What does "Analyze audio for flex time editing" in Garage Band? It's taking so long(3 days)! and I can't shut down my pc.

    Did you ever figure out what was going on? i've got the same issue.
    I record 2 hour choir practices then edit the talking out to make more useful accompaniments for personal practice. During my editing process my MacBk Pro (0r GarageBand) decides it needs to "Analyzing audio for Flex Time Editing". It will finish doing it and immediately start over again. I can not cancel it so I just have to force quit Garageband and lose eveeryrthing I have editied since my last Save. I've shut my mac totally off and rebooted and to no avail. Any suggestions?

  • What does "browser.newtabpage.storageVersion" do?

    What does that pref do? If I make it 1, thumbnails folder in profile isn't created anymore (that exactly what I want)
    But this not default about:config entry. Is there any documentation about it?

    If I do as you said, thumbnails are disabled, ok. But in profile folder, empty "thumbnails" folder is created every time.
    I use these prefs for disabling thumbnails. (also re-creation of empty thumbnails folder)
    user_pref("browser.newtabpage.enabled", false);
    user_pref("browser.newtabpage.storageVersion", "1");
    user_pref("browser.pagethumbnails.capturing_disabled", true);
    user_pref("browser.pagethumbnails.storage_version", "2");
    And if I right click on the pref "browser.newtabpage.storageVersion" and make default it. It is being deleted and it start empty folder named thumbnails in prfile folder.

Maybe you are looking for

  • Works in sqvi but not work in code

    select-options :zu_vbeln for  vbak-vbeln no intervals. select MAKTMAKTX MAKTMATNR     into (ITAB-MAKTX , ITAB-MATNR)     from ( MAKT            inner join VBAP            on VBAPMATNR = MAKTMATNR )            where MAKT~SPRAS = 'HE'              and

  • Linking to a pdf from an ebook

    A curious problem: Using hyperlink panel, I referenced a "pdf" within a document and exported to epub. The epub highlights link as a hyperlink, but either does nothing or jumps back to previous entry in content list. I opened up the epub and added th

  • IU Elim. "No data found for processing using current selection conditions""

    Dear Experts, While Executing task of Interunit elimination  in Consolidation Montior  I am getting Message "No data found for processing using current selection conditions" Ex. is A) In Unit X GL (399999) Account     Dr. 65000 (Customer Recon. Ac.) 

  • Iphone 4 vs iphone 4s

    Is there significant advantages of the iphone 4s over the iphone 4

  • Directory sverly damaged on external drive, other programs than Disc W.

    I have an external Lacie USB 2 drive connected to my G5, now some files refuse to open, I ran the OsX Harddrive tools and it states that there is nothing wrong with the disc and when I do a harware check with Disc Warrior it states that the disc is f