Threadpool, cancelling jobs and notify when done

Hi all,
I already have some experience in using the ThreadPoolExecutor class, however, I am not sure about how to use it for my next project. I am using a thread pool that consists of just one thread (because the job is extreme hard disk I/O intensive it doesn't make sense to have more than one thread). I have a GUI that puts a few jobs into the queue and the threadpoolexecutor performs its work. My two questions are:
1)
How can I make the ThreadPoolExecutor stop working on tasks that it has not begun yet? I mean, I do want that the current job that the worker-thread is working on will get finished, but I just want all the other tasks that are still in the queue to be removed from it. So neither shutdown() nor shutdownNow() are the right method for me, especially since shutdownNow() would also interrupt the current thread which I don't want.
2)
Is there a way that my GUI is notified once the ThreadPoolExecutor finished all jobs in the queue?
Regards

1) Have you tried ThreadPoolExecutor.getQueue().clear() ?
2) add a task to the thread pool to notify the GUI (as it single threaded it will only be run once all the other tasks are finished)
If you are worried about more tasks being added and you want to wait for them, you can check the queue length and add the job again if the length > 1
OR
You can override afterExecute() to check the queue length and perform the action want when the queue is empty.

Similar Messages

  • P2055 randomly runs a Print Page before a job, and randomly when computer is on

    Before many print jobs, the P2055dn prints a page that is blank except for the follwing at the top of the page:  GET /DevMgmt/DiscoveryTree.xml  HTTP/1.1
    Host: 127.0.0.1:8080
    How can I make this stop?  I have the latest print drivers.  Running Win 7 64 bit.

    2605dn has same problem as P2055 randomly runs a Print Page before a job, and randomly when computer is on
    Before many print jobs, the 2605dn prints a page that is blank except for the follwing at the top of the page: GET /DevMgmt/DiscoveryTree.xml HTTP/1.1
    Host: 127.0.0.1:8080
    How can I make this stop? I have the latest print drivers. Running Win 7 64 bit.
    The fix for the 2055dn does not work on the 2605dn so does anyone have a fix for 2605dn - tech help and driver useless as usual

  • I need to use Outlook Express to apply for jobs and I either don't have it but when I try to send an e-mail on Outlook Express, it won't go through and gives me an error report.....I really need to be able to use Outlook Express to apply for jobs. Help!

    When I try to apply for job and when I try to e-mail my resume' and Outlook Express comes up to reply to on, I put in my information, etc but when I hit send, it doesn't go through and says? POP and then error report and doesn't go through.

    I can't provide a solution with or without the error message, but without an error message, you are making everyone guess at what you see. I have no idea what you see, and I think someone who might be able to help you solve your problem would need to know what that message says. Is "Outlook Express" (Windows Live Mail) your default email processor, if not what is?

  • Is it possible to RESTORE cancelled job and run it.

    Hello Experts,
    This question is regarding restoring old background jobs which were cancelled.
    I have a report which runs in background with one variant. The report has a date as a selectionscreen input. This date is used by the program as field AUDAT to get the Sales orders from VBAK. The purpose of the program is to fetch the Sales Orders on a daily basis.
    So I scheduled a job for this report on a daily basis. I created a variant and I used the selection variable 'current date  in the attributes of variant for the date field(AUDAT) of selection screen.
    So the background job will run daily by passing that days date to AUDAT field.
    My problem is 2 days back the job got cancelled. Today is it possible to restore that old job and fetch the Sales Orders for which AUDAT is 2 days back from today?
    Today I tried to reschedule that cancelled job, but I am getting the sales orders for which AUDAT is todays date but not 2 days back date.
    Can you people please help me.

    Hi Zloch,
    That is a perfect solution. Thanks. Thankyou very much. I implemented that. But I got another problem. I implemented as you directed, but the job got cancelled. In the Job Log I am seeing the message  'ABAP/4 processor: EXPORT_INIT_COMPRESS_FAILED'. When I double clicked it, it taken me to the short dump of that error and the short text is 'Compression error with EXPORT'. It said that the Error is in the SAP kernel and the current ABAP "SAPLSLST" program had to be terminated because the ABAP processor detected an internal system error. It has shown that the error is in include LSLSTF06 of program SAPLSLST. But my program has not used any of these includes and function modules.
    Can you please suggest what could have  went wrong? Did I do anything wrong while creating the variant or backgrond scheduling?
    Please let me know your kind suggestions.
    Regards.

  • HI. I have been receiving an error message recently when opening itunes the message says "itunes has stopped working. Windows will close theprogram and notify when a solution has been found." Anyone able to help?

    I've checked the problem reports and solutions on my laptop and this is what popped up.
    Problem signature
    Problem Event Name:    APPCRASH
    Application Name:    iTunes.exe
    Application Version:    10.5.3.3
    Application Timestamp:    4f14cc3d
    Fault Module Name:    iTunesMobileDevice.dll
    Fault Module Version:    503.2.0.1
    Fault Module Timestamp:    4ea63899
    Exception Code:    c0000005
    Exception Offset:    0003a5d0
    OS Version:    6.0.6002.2.2.0.768.2
    Locale ID:    2057
    Additional Information 1:    fd00
    Additional Information 2:    ea6f5fe8924aaa756324d57f87834160
    Additional Information 3:    fd00
    Additional Information 4:    ea6f5fe8924aaa756324d57f87834160
    Any help you could give would be awesome!

    For general advice see Troubleshooting issues with iTunes for Windows updates.
    The steps in the second box are a guide to removing everything related to iTunes and then rebuilding it which is often a good starting point unless the symptoms indicate a more specific approach. Review the other boxes and the list of support documents further down the page in case one of them applies.
    Your library should be unaffected by these steps but there is backup and recovery advice elsewhere in the user tip.
    If you've already tried something like the above then try opening iTunes in safe mode (press and hold down CTRL+SHIFT as you start iTunes) then going to Edit > Preferences > Store and turning off Show iTunes in the Cloud Purchases. You may find that iTunes opens normally now.
    tt2

  • Problem with CUPS and Canceling jobs

    I am using OS 10.3.9 on a 1.42 MDD PowerMac
    I am having a problem trying to cancel Jobs using the CUPS interface. When I select "Cancel" I get an error "client-error-forbidden".
    I have tried logging in as Root but the same error occurs.
    I have run "CacheOut" and deleted all cache thinking that it would solve my problem.
    I can't seem to find any answers anywhere.
    I have 1 fax job and 1 print job that I would like to remove from the Que.
    If I knew where these files were I would manually delete them, but I cannot find them, except in the CUPS interface
    I was thinking of installing CUPS 1.2b2, as it has more features and maybe it would solve my problem.
    Are there any problems that I should know about before installing this software. If I install it I can't go back to my original CUPS without re-installing the system.
    Thanks,
    Nick
    G4 1.42 MDD   Mac OS X (10.3.9)   2 GB memory

    Nicholas,
    I assume you're talking about accessing your printer from your browser by using the URL http://127.0.0.1:631/printers/
    Understand you can't log in as Admin?
    Do you have an appication named after your printer in the folder Home/Library/Printers ? If so, click on it and see if you can see your job.
    If not, try downloading Printer Setup Repair from:
    http://www.fixamacsoftware.com/software/index.html
    Seems to do a great job in fixing problems, and might restore your ability to monitor your print jobs. I was only able to monitor and delete my print jobs through the CUPS interface on my browser until I ran Printer Setup Repair. After that, I was able to use the application mentioned in my first paragraph to do the monitoring (and it works great!)
    Hope this helps!
    Bob

  • When i load i tunes, it comes up with error message stating "i tunes has stopped working.A problem caused the program to stop working correctly. Windows will clode the program and notify you if a solution is available". I have no idea to fix

    New laptop, load itunes to find a error message that states, "i tunes has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available". It has me stuffed on such a problem that should be easy to load. Please help!!!!

    Hey there Rodney274,
    It sounds like you are getting an error from iTunes when you launch it. I would try the troubleshooting in this article named:
    iTunes for Windows Vista, Windows 7, or Windows 8: Fix unexpected quits or launch issues
    http://support.apple.com/kb/ts1717
    Start with troubleshooting for 3rd party plug ins section, then the rest of the article if needed:
    Start iTunes in Safe Mode
    Open iTunes in Safe Mode to isolate any interference from plug-ins or scripts not manufactured by Apple.
    Hold down Shift–Control while opening iTunes. You should see a dialog that says "iTunes is running in safe mode" before iTunes finishes starting up.
    Click Continue.
    See if the issue you're experiencing persists in Safe Mode.
    If you have the same issue while iTunes is in Safe Mode, proceed to the "Create a new user account" section. If you don't experience the same issue, follow these steps to remove third-party plug-ins.
    Thank you for using Apple Support Communities.
    Take care,
    Sterling

  • I've updated my phone and I've made a backup. but now it says I must enter my code to restore all my files and I haven't got this code. If I cancel the process or choose something else, all my stuff will be deleted, and I really don't want that.

    I've updated my phone and I've made a backup. but now it says I must enter my code to restore all my files and I haven't got this code. If I cancel the process or choose something else, all my stuff will be deleted, and I really don't want that.
    HELP ME PLEASE!!!

    If, for some reason, your backup got encrypted and you don't know the code, you'll have to set up your phone as new device and start all over again without the backup.
    Warning: If you encrypt an iPhone backup in iTunes and then forget your password, you will not be able to restore from backup and your data will be unrecoverable. If you forget the password, you can continue to back up and use the device, however you will not be able to restore the encrypted backup to any device without the password. You do not need to enter the password for your backup each time you back up or sync.
    If you cannot remember the password and want to start again, you must perform a full software restore and when iTunes prompts you to select the backup from which to restore, choose set up as a new device.
    If you can't get pass the lock screen, connect in recovery mode and restore the phone, you'll have the option to reset the lock secreen passcode.
    iOS: Unable to update or restore and iPhone and iPod touch: Wrong passcode results in red disabled screen
    If you cannot remember the passcode, you will need to restore your device using the computer with which you last synced it. This allows you to reset your passcode and resync the data from the device (or restore from a backup). If you restore on a different computer that was never synced with the device, you will be able to unlock the device for use and remove the passcode, but your data will not be present. Refer to Updating and restoring iPhone, iPad and iPod touch software.

  • Hi, I by accident bought a book in the IStore, but I could stop the download. So I didn´t receive the book yet. How can I cancel the purchase? I don´t want this book and so I don´t want to pay for it.

    Hi,
    I by accident bought a book in the IStore, but I stopped the download.
    So I didn´t receive the book yet.
    How can I cancel/reverse/countermand/recind the purchase?
    I don´t want this book and so I don´t want it and so I don´t want to pay for it.
    Thanks

    Hello cocoonfire,
    The best thing to do would be to contact iTunes Store support directly to see what can be done.
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    http://support.apple.com/kb/ht1933
    To report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase, follow these steps:
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Regards,
    Sterling

  • How to get notify when system get wakeup call and gets connected to internet?

    Hi,
          In my project I need to get notify when system wakes up from sleep and also while system gets connected to WAN or LAN.Can any one please give suggestion on this.Thanx:).

    Your entire Utilities folder and/or its contents was deleted?
    If so, I suggest performing an Archive & Install selecting preserve user and network settings. If not and you don't know exactly what your boy deleted (have you checked the Trash?), performing an A&I will take care of everything known or unknown at once.
    http://www.thexlab.com/faqs/archiveinstall.html
    Now is also a good time to create a backup - preferably a bootable clone backup of your entire hard drive saved to an external firewire drive used for backup purposes only.
    And I also suggest creating a computer login account for your boy WITHOUT admin privileges and disable automatic login for your admin account which will require manually entering your log in password for your admin account during a computer startup, restart and with Fast User Switching.
    Before stepping away from your Mac or whenever it will be used by anyone that is unattended by you, log out from your account.
    Keep the install package for your Mac in a safe place but in a location that is not known by your boy.
    http://www.apple.com/macosx/features/family/

  • HT5622 Why is it every time I try do download a free apps or games it requires me to fill up a credit card information since I don't have one so I cancel it and It won't able to continue to download?

    Why is it every time I try do download a free apps or games it requires me to fill up a credit card information since I don't have one so I cancel it and It won't able to continue to download?

    You can create an iTune and App Store account without credit card details
    1. Sign out of current Apple ID if you are sign-in to one (important)
    2. Go to App Store and select a free app
    3. Tap INSTALL APP
    4. Create New Apple ID
    5. Confirm Your Country
    6. Agree with Terms and Conditions
    7. Fill in your Apple ID and Password (you must create a new Apple ID; don't use your old Apple ID)
    8. Create and answer your secret question
    9. Select NONE for Payment Method
    10. Fill in Billing Address
    11. Submit application for new Apple ID
    12. Wait for verification email
    13. When email arrive, verify your account
    14. Start downloading your free apps

  • Control  for cancelling the excise invoice when MIGO done against this invo

    Is there any user exit or BADI to control the cancellation of exicse invoice when MIGO done against this excise invoice.

    Hi,
    You can put your validation during invoice cancellation via copying requirements of billing types at the cancellation section.
    Create your own routine and assign it to corresponding billing types.
    Hope this help.
    Cheers,

  • I have a new MAcBook Air and my photos don't fit on the internal hard drive.  I want to store my photos on an external hard drive which I will connect to my Air when using Iphoto.  How do I set an external hard drive as the default drive?

    I have a new MAcBook Air and my photos don't fit on the internal hard drive.  I want to store my photos on an external hard drive which I will connect to my Air when using Iphoto.  How do I set an external hard drive as the default drive in Iphoto?

    Make sure the drive is formatted Mac OS Extended (Journaled)
    1. Quit iPhoto
    2. Copy the iPhoto Library from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    Regards
    TD

  • [svn:fx-trunk] 9407: Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties .

    Revision: 9407
    Author:   [email protected]
    Date:     2009-08-19 15:11:34 -0700 (Wed, 19 Aug 2009)
    Log Message:
    Reordering the if-statement in isMeasureFixed() exposed that hostFormat can be null when measure() is called if styles changed and measure is done before the next commitProperties.  This states test exposed this.
    We should rethink if we want to clear hostFormat rather than have a hostFormatChanged flag.  If there is no hostFormat at measure then it has to be fixed because there is no line break format to check for auto-size.
    QE notes:
    Doc notes:
    Bugs: SDK-22779
    Reviewer: Gordon
    Tests run: checkintests
    Is noteworthy for integration: no
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-22779
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/primitives/RichEditableText.as

    Oh my god, it is too long! You definitely check out types, casting and especially ODP.Net (it does everything for you)... etc. They can help you to simplify your code. I do not have enough time to copy paste it to Studio and understand and solve your issue, so I got title of your message as your main question.
    In Oracle, you can create an autonumber field by using sequences object. This is really useful when you need to create a unique number to act as a primary key.
    Basically you can create a sequence simply typing;
    CREATE SEQUENCE MY_SEQUENCE;
    now you have a sequence called "MY_SEQUENCE"... Then, I advice you select a number from sequence;
    select MY_SEQUENCE.nextval from dual;
    I said I advice actually kinda must, although it called sequence, I cannot be sequential. Do not even try to predict the value. You can be sure that it is unique number so you can use it.
    Then insert you record and use that number part of your primary key. I think that's it. Have fun.

  • How do I change my icloud email when don't know the old password after I have changed my apple ID email address and the password? icloud is still online with my old email address!!!

    I got a new phone but backed it up through my itunes, and when I tried to use icloud it kept telling me I have forgotten my password, when I really really didn't. So I went to settings > itunes&appstore and changed my password, but also changed the email address too while I was at it, since I've always wanted to change it. But now here's the problem. My iphone's icloud is currently logged in with my old apple ID email address, which seems to not work with the new password, so I can't log it or even delete the account off my iphone. And ovbiously, I don't know the old password that I have "forgotten", as my phone tells me. There seems to be no way of changing the icloud account now.... What should I do?!

    So what was the solution. I have a similar problem on all of my devices now

Maybe you are looking for