Remove a task from a ScheduledThreadPoolExecutor

hi ,
i have a small program that creates a ScheduledThreadPoolExecutor , and insert one Runnable task into it.
the task should be preformed for given time and then cancelled.
but for some reason i can't remove the task from the thread pool , and it keeps on going.
here is my code :
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.Calendar;
public class TimeTest {
    private static ScheduledThreadPoolExecutor executor;
    private Runnable task;
    public TimeTest(){
        executor = new ScheduledThreadPoolExecutor(10);
        task = new MyTask(System.currentTimeMillis() +15000);//death time is 15 seconds from now
        executor.scheduleAtFixedRate(task, 5L, 5L, TimeUnit.SECONDS);
    public static void removeTaskFromThreadPool(Runnable task) {
        executor.remove(task);
    public static void main(String[] args) {
        new TimeTest();
    public class MyTask implements Runnable {
        private long deathTime;
        public MyTask(long deathTime){
            this.deathTime = deathTime;
        public void run() {
            if(deathTime - System.currentTimeMillis() > 5000){
                System.out.println("time = " + Calendar.getInstance().getTime());
            }else{
                System.out.println("removing MyTask");
                TimeTest.removeTaskFromThreadPool(this);
}thank in advance and a happy new year :-]

private static ScheduledThreadPoolExecutor executor;
private Runnable task;
private ScheduledFuture future;
executor.scheduleAtFixedRate(task, 5L, 5L, TimeUnit.SECONDS);
future = executor.scheduleAtFixedRate(task, 5L, 5L,  TimeUnit.SECONDS);
public static void
removeTaskFromThreadPool(Runnable task) {
executor.remove(task);
    future.cancel();

Similar Messages

  • Editing a task in GW Cal removes the task from the tasklist

    User assigned herself a task and copied her supervisor. If she goes in and edits the task it remains on her calendar but removes it from her tasklist folder. Why can you not see edited tasks in the tasklist folder? Thanks.

    In article <[email protected]>, Ischernandez
    wrote:
    > User assigned herself a task and copied her supervisor. If she goes in
    > and edits the task it remains on her calendar but removes it from her
    > tasklist folder. Why can you not see edited tasks in the tasklist
    > folder? Thanks.
    >
    An excellent question, I get the same behaviour, and it certainly sounds
    wrong and not how I've experienced using Tasks in the past (I haven't
    used GW directly much for tasks in a few versions)
    What happens if her supervisor edits the task?
    What if her supervisor creates the task and issues it to her and then she
    edits it?
    It would be very interesting to see how different combinations of people
    creating/editing shows up.
    Do you have much in the way of SRs available to you? If you do that
    might be the way to go, otherwise we certainly have other methods
    available to dig for you.
    Andy of
    KonecnyConsulting.ca in Toronto
    Knowledge Partner
    http://forums.novell.com/member.php/75037-konecnya
    If you find a post helpful and are logged in the Web interface, please
    show your appreciation by clicking on the star below. Thanks!

  • Problem with remove task from schedule in PWA

    In our environment problem with remove task from schedule by PWA.
    Problem is only when I want to remove few task in the same time, but the operation one by one is correct.
    In my opinion problem is with calculation schedule after remove tasks, column ID include wrong value it means that Number ID does not generate in the correct order same of numer
    disappear. Click Calculate button on ribbon causes problem with finshed operation and save project.
    Problem occurs only machine with IE 11.0 browser without compability mode, on other machine for example on the same project with IE 8,9,10 everything is correct.
    Problem appeared recently, earlier everything was OK.
    Txn, Dariusz Moczyński

    Hi Darius,
    I'm a bit confused. You are now talking about 2 issues.
    For the first one, you cannot edit anymore tasks in PWA, with any browser versions? Is it happenonog for any users on any projects? Try the following solutions publish the project from Project Pro and see if it helps. Press CTRL F5 to delete IE cache. Ensure
    that your PWA URL is added to the trusted site and/or compatibility sites. Check for the ULS logs or javascript errors.
    For the second issue, please refer to my previous reply, this obviously cannot be considered as a bug since it is happening with a non supported browser version and working properly on supported versions of IE.
    Hope this helps,
    Guillaume Rouyre, MBA, MVP, P-Seller |

  • Remove Actionable links from human task notification??

    Is posible to remove the link from the human task notification mail.
    Thanks...

    yes, if you recompile the *.jar and remove the setting "make notifications actionable" (you can find it in the human task definition)

  • N80 IE: Synchronisation removes tasks from Outlook

    Hi,
    The sole reason I use a Nokia (and changed an LG for my current model) is it's synchronisation capabilities with Outlook. Specifically, I use it to synchronise my calendar with Outlook.
    When I synchronise my calendar, my tasks are copied too. These tasks I do not want to see in my mobiles calendar. So I remove them. But the next time I synchronise these tasks are removed from Outlook. And that is not what I want to happen. As a result I need to copy the deleted data from my Synchronisation manager to Outlook again.
    So, my question is: Does anyone know how I can instruct my the Nokia PC Suite NOT to synchronise my tasks (or to delete tasks from Outlook)?
    Abel
    Edit:
    Wrong version number mobile. Changed from N90 to N80
    Message Edited by macadam on 22-Sep-2008 09:14 AM

    hi Damir0408,
    I understood your problem so that.
    you are using
    * Windows XP, SP2 and Micrsoft Outlook 2003 SP2
    * PC Suite version 6.81.13.0
    Enabled PC sync between N80 (firmware?) and Outlook.
    Sync direction is set to both ways? Or just one way?
    Conflict resolution is set to Outlook, N80 or both?
    I just created a note on my N80, synced to Outlook and the note is visible in Outlook. Then I edited my note on my N80 and ran PC Suite sync again. The note was updated in my Outlook.
    I understood from your post that this is were you have an issue. The note is not updated in outlook if you edit it on the N80.
    You could check your PC suite version, N80 firmware version (*#000#) and your advance sync settings.

  • How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    How to remove a click from a sequence file mp4 or mp3, and make it only sequence left and right in GarageBand?

    "adrianTNT" <[email protected]> wrote in message
    news:e6aitv$hkm$[email protected]..
    >
    quote:
    Originally posted by:
    kglad
    > you're welcome. with your solution loading another mp3,
    are you sure it stops
    > the download of the first mp3?
    > Yes, it seems to work fine, it loads another sound in
    same sound (my_sound)
    > and it seems to replace loaded progress with the empty
    sound I gave and stops
    > previous loading.
    > I look at traffic icons on task bar and I see that there
    is no network traffic
    > after I click "stop" before this I could see continuous
    traffic while sound was
    > loading in background.
    Yeah, I remember someone posted that solution a long time
    ago. It seems if you load a file with the same name the cache
    doesn't
    know any better and adjusts the download size to the smaller
    one. Maybe it's a good way to do it! Could it be a way to remove an
    mp3 from someone's cache after it plays? hmmmm Will have to
    do more testing.
    tralfaz

  • Collaboration Room Task - Remove New Task button

    Hi,
    We have My Task iView on all our home pages which are available to internal and external users. We do not want to give "New Task" button for external users. Is there any way to hide New Task button based on Users or Roles, or remove New Task button from the My Task iView. Please let me know if you know any other solution.
    Thanks
    Som

    Hello,
    there is an update in the configuration documentation coming up shortly (In oct.) - it wil be available online on the Help portal.
    But as of now, please follow the process as listed here:
    also please let me know in case this is not working for you.
    Removing Actions From the UWL Display
    There are a couple of ways to remove actions. 
    ·        You can customize the Views and ItemType (which can remove the actions from all UWL pages, Collaboration, My Task, and so on)
    ·        You can modify the iView and add the name of the actions under the Action to exclude from the UWL property.
    See the list below for some of the common action names.
    Note: For other actions not listed here, see the custom properties XML files.
    in the list below you will see the "Display Text" for the action followed by the "Action Name"
    Alerts Configuration 
    AlertConfiguration
    Claim --- reserve
    Complete---- acknowledge
    Complete Task --- confirm 
    Create Ad Hoc Request --- uwlTaskWizard
    Create Task --- defaultGlobalWizard
    Decline --- decline
    Delete  -
    deleteItem
    Edit --- editItem
    Follow-up --- followUp
    Forward --- forward
    Forward --- forwardUsers *
    Manage Attachments --- manageAttachments
    Open Task --- launchSAPAction
    Personalize View --- personalize
    Revoke Claim --- replace
    Submit Memo --- addmemo
    View Detail in SAP Gui -
    launchSAPDetails
    - this action is for multiple user selection.
    Note:
    If excluding more than one actions, the action names must be comma separated.
    Note:
    Do not add ALL of the above listed action names to Actions to Exclude iView property. Be selective in what actions you want to remove. To determine the action name you want to remove, you can turn on the support information page (see below) and a list of support action will be displayed per item displayed.
    Example
    Suppose you do not want the Personalize View function on the UWL view. You can remove it by adding personalize to the iView property List of UWL Actions to Exclude.
    Turning on the Support Information Section
    From the UWL iView configuration, select Yes for the parameter Display UWL Support Information.

  • Error Removing SharePoint Task Attachments via Outlook

    Hello,
    I'm having some trouble with my SharePoint (2010) task list when handling attachments via Outlook (2007 SP3). I created a set of simple Outlook macros for updating SharePoint tasks. I can create and update the tasks without issue and even attach files to
    the task which successfully sync with SharePoint. The error comes when attempting to remove the attachment:
    Task 'SharePoint' reported error (0x80004005) : 'One or more items failed to copy. Changes that were made to their attachments are not compatible with the server. The failed items were moved to your Local Failures folder and replaced with copies from the server.
    If you need assistance troubleshooting items in your Local Failures folder, a Help topic is available at the following address: http://go.microsoft.com/fwlink/?LinkId=70300. For details, see the log file .'
    At first I figured it was my macros so I manually created a SharePoint task and attached a file in Outlook. When I manually attempted to delete the file I received the same error. Researching the error lead to two issues: uploading PDLs and Assigned SharePoint
    contact missing valid email. I checked for both and neither are the case.
    As info, the SharePoint list was connected to Outlook per the instructions found on other pages. Is there some limitation to removing task attachments in SharePoint? Any help you can give me would be appreciated.
    Best

    Hi,
    For your issue, it can be related with attachments in the task item. Please make sure attachments have subject that not ends with a dot.
    Reference:
    http://stackoverflow.com/questions/22472121/synchronizing-tasks-from-sharepoint-list-to-outlook-task-list
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Project 2013 No Server, No Sharepoint, Updating Tasks From Assigned Resources Through Email

    Ok,
    I have searched high and low for this type of information and Im surprised after all these years that no one has asked or requested this type of information?
    I am a consultant, with my own version of Project 2013 to track how I run Projects.  This is the tool I use.  So this being the case it makes no sense for me to spend millions of dollars for Project Server.  I am just one person useing this
    as my tool of choice.
    My issues are:
    I create and assign a task to a resource with a name and an email address.
    I litterally have thousands of tasks with hundreds of assigned resources (People) with an email address.
    I need to update weekly all my task!!!  The entire point of using Project 2013 as a tool!
    However it appears Microsoft needs to make this very dificult to do. If I have to manually email all these people with task and manually ask them for an update, then manually update all these task then whats the point of even bothering using Micrsofts Project
    2013?  It is useless.
    I need a way to automate these updates without having a Server.
    The Question no one seems to be asking is this?
    Is there a way to update task through email, (Outlook), Why cant I send emails with a table of tasks assinged, request update in the task table, then the assigned resource sends me back the email with thier updates and I can automatically update my Project
    Task?
    Am I the only one who has asked this or thought of this?  Or are my expectations to high? I cant figure how Microsoft could ever expect a single user of Project even with only one project with 50 to 100 task listed to have to get on the phone or emal
    every single person manually, and manually update every single task every single week? I have used other Project type apps and they all have a way of sending emails out to assigned people to get task updates automatically.  Only Project doesnt! 
    Why?

    Thanks Prasanna,
    Really for the amount of money I have to pay for a Product that should have some way to update tasks.
    Think about this for minute.  I believe Project 2007 was able to do this ,,,, that made sense.... 
    Really ponder this question:  What is the purpose of Microsoft Project for a single user?  Does anyone ask these questions prior to development?
    The reason for Project to exist is to TRACK TASK!  THATS IT! Why would anyone want to track any type of task, hundreds of task MANUALLY?  It does me no good for me to be the only one tracking task.  It does me no good for me to be the only
    one looking at the task schedule.  Great, so IM THE ONLY ONE WHO KNOWS WHATS GOING ON? 
    So I ask this question.
    If this is the case then what is the point of tracking anything if it cant be shared or updated in some way or another?  Microsoft Project is useless as a single use product!
    Here is the kicker....
    I can purchase Outlook for a lot less, I can track any and all task, assign task to anyone with an email, I can assign and schedule task through Outlook and place an alert, set it as an appointment through the Calendar, change and assign start and end dates,
    and get updates through email on any task, calendar, anything.... Why then would I waste ANYTIME OR MONEY ON A USELESS TASK TRACKING PRODUCT LIKE PROJECT?  It does not do anything?  Outlook does a thousand times more than Microsoft Project! 
    Does that make any sense to anybody?  All Microsoft Project really is... is a stripped down Calendar/Task from Outlook with no ability to email, or communicate in any way shape or form with other people who are assigned the work.  What ends up happening
    is Microsoft expects single users to purchase Project Server?  Are you crazy?  This is the single reason why Project does not sale!  If Microsoft would go back to sales metrics of Project 2007 they would see a decline till now that will reflect
    this problem.  Its really a simple fix.  Sales would triple.  Until there is a solution it makes way more sense for me to use Outlook, schedule work task on others calendars and have them send me an update weekly through an automated spreadsheet
    through Outlook.  From there all the reports exist in Excel.  Why do I need Project anymore?  BTW  I have been a MS Project user since its inception....  SO IM not new to it... what a terrible waste of time, resources, and lack of
    vision for just a simple powerful addin that was removed after 2007.  Single users like myself will never purchase Project Server just so we can send emails with assigned task for an update,,, silly?

  • How to remove an object from Buffer Cache

    Hi,
    I have a simple question. How can I remove an object from the Buffer Cache in Oracle 10gR2 ?
    I am doing some tuning tasks in a shared development database, so I can't do "alter system flush shared_pool" because it will affect other people who are running their queries. So I want to remove from Buffer Cache only the objects that I know that I am the only reader. I can see the objects that I want to be removed by querying the V$BH view.
    By the way, I did some "alter system flush shared_pool" and my objects were not removed from the Buffer Cache, and they are not in the "Keep".
    Thanks In Advance,
    Christiano

    Further more, you can use CACHE | NOCACHE on table level to indicate how you want Oracle handle the data blocks of said table.
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_7002.htm#i2215507
    CACHE | NOCACHE | CACHE READS
    Use the CACHE clauses to indicate how Oracle Database should store blocks in the buffer cache. If you specify neither CACHE nor NOCACHE, then:
    In a CREATE TABLE statement, NOCACHE is the default
    In an ALTER TABLE statement, the existing value is not changed.
    CACHE For data that is accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the most recently used end of the least recently used (LRU) list in the buffer cache when a full table scan is performed. This attribute is useful for small lookup tables.
    As a parameter in the LOB_storage_clause, CACHE specifies that the database places LOB data values in the buffer cache for faster access.
    Restriction on CACHE You cannot specify CACHE for an index-organized table. However, index-organized tables implicitly provide CACHE behavior.
    NOCACHE For data that is not accessed frequently, this clause indicates that the blocks retrieved for this table are placed at the least recently used end of the LRU list in the buffer cache when a full table scan is performed. NOCACHE is the default for LOB storage.
    As a parameter in the LOB_storage_clause, NOCACHE specifies that the LOB value either is not brought into the buffer cache or is brought into the buffer cache and placed at the least recently used end of the LRU list. The latter is the default behavior.
    Restriction on NOCACHE You cannot specify NOCACHE for an index-organized table.
    CACHE READS CACHE READS applies only to LOB storage. It specifies that LOB values are brought into the buffer cache only during read operations but not during write operations.

  • How to remove an instance from essbase cluster

    I installed the new Hyperion 11.1.2, and I reconfigure the essbase server, it is added to the EssbaseCluser_1, now I have set up 2 instances for this cluster. Now I want to remove an instance from the cluster, how to do it with MaxL or what ever?

    [url=http://download.oracle.com/docs/cd/B19306_01/serv
    er.102/b14200/statements_8009.htm#i2157988]DROP
    DATABASEInstance and Database are different things, be careful before using this statement after 10g :)
    [from-documentation]
    An Oracle server consists of an Oracle database and an Oracle instance.
    The database consists of physical files such as:
    The control file where the database configuration is stored
    The redo log files, which have information required for database recovery
    The data files where all data is stored
    The parameter file, which contains the parameters that control the size and properties of an instance
    The password file, which contains the superuser (SYSOPER and SYSDBA) passwords
    The instance consists of memory structures such as System Global Area (SGA) and Program Global Area (PGA) and background processes that perform tasks within the database as well as the server processes that are initiated for each user session.
    The size and structure of an Oracle database and instance impact performance. The physical structure of the database impacts the I/O to hard disks. It is therefore important to both size and place the physical files in such a way that I/O across disks is distributed evenly and waits are minimized. The size of the various memory areas of the instance directly impacts the speed of SQL processing.
    [from-documentation]

  • How can I completely remove Java JRE from my system?

    Hi,
    the installation of an earlier version of JRE didn't finish properly (1.5.??), since then it isn't possible at all neither to deinstall it nor to install ANY version (stops on extraction of the installation files, the process must be killed by the task manager!). It seems as if there are some incorrect statements left in the registry.
    When I try to install the latest version, it stops with a "missing version information" error.
    Is there any possibility to remove ALL statements belonging to Java out of the registry without doing it manually, so that I can install the latest version? Or does anyone of you have a better idea?
    THX,
    Christian
    Edited by: ChrizzLee on Oct 22, 2007 12:32 PM

    If the uninstaller has already lost some files, it will be diffcult to uninstall properly from Add/remove programs. Its better to remove the entry from registry.Actually you can do it safe without much problem.If no other versions of java are installed, delete the javasoft key (entire tree)from LOCAL_MACHINE\SOFTWARE. Then reinstall jdk.It should splve the problem

  • Move task from transport request

    Hi,
    I've created a report and I assigned the development to a wrong transport order.
    How can I move the task to another transport order?

    I think you are meaning workbench transprot request request by transport order. If it is, then yes you can move the task from the wrong transport request. Follow these steps
    1. Go to SE10 and find the transport request.
    2. Now locate the task under which your report is assigned in the transport request. Now expand the task and right click on your report name and select 'Delete'. It will give some warning message, select yes every time and the report will be removed from the transport request.
    3. Now go to SE38 and open your report. Then try to save it. it will again ask for transport request. Now give the correct transport request.
    Thanks,
    Mainak

  • Removing Hidden Devices from VMs

    I've been tasked with coming up with a script that will remove hidden devices from VMs. Anyone who's used VMs before knows that sometimes "ghost" devices show up. We've had a few problems recently and would like to write a script that will, on
    startup, remove any of these hidden devices (yes, I'm fully aware some may be needed, we have logic that will not nuke them all).
    Say I have an array that contains devices in WMI type format, let's call that list "$devices"
    How would I remove each one using powershell? I've tried devcon, but I feel like I'm not getting the syntax right, my script is doing the following:
    foreach ($device in $devices){
    $toremove = $device.name
    c:\windows\system32\devcon.exe remove $toremove
    Is there a better tool than devcon, like maybe a PowerShell cmdlet (even one I have to download from somewhere)? If not, could someone help me get my syntax right (or tell me I need to use invoke- ?)
    Thanks in advance.
    [email protected]

    Hi Zarberg,
    I’m writing to just check in to see if the suggestions were helpful. If you need further help, please feel free to reply this post directly so we will be notified to follow it up.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to disable an out of the box disable User process task  from resource?

    How should I disable the out of the box disable User process task that is assigned to a particular resource? If I disable this disable User process task, when the user is provisioned to the same resource will I be able to stop this disable User process from running?
    My requirement: I need to disable the disable user process task from three resources x, y and z. Whenever a user is provisioned to one of these resources I should stop this disable user process task an out of the box process task from running. How can this be accomplished?? Please help me out on how to configureto remove the process task in the OIM Admin console to stop the process task.

    You can avoid the disable task from triggering by removing the Disable Process Or Access to Application from the task effect drop down in the process task. But this task is triggered once the user is disabled. But still I didn't understand the exact scenario.
    By the way the disable task is triggered when the user gets disabled and not when the user is provisioned.
    Edited by: vindla on Aug 1, 2011 10:26 PM

Maybe you are looking for

  • Flash Remoting -  connection/server errors

    Hi people, I would like to catch the error in the client-aplication (Flash) and give the user a friendly msg when the server is unavaliable ( due to connetion problems / connection timeout). For that kind of error I get nothing in the FaultEvent Obje

  • Drop down menu turning to all caps after clicked in browser

    Problem. drop down menu turning to all caps after clicked in browser, instead of staying upper and lower case. Originally, I made the drop downs in fireworks CS3. Then when I work with them in dreameaver CS3. It looks perfect UNTIL  ... after clickin

  • BAPI_GOODSMVT_CREATE using inbound delivery with HU

    I have a program that uses BAPI_GOODSMVT_CREATE to GR Post the inbound delivery.  The inbound delivery is created thru ASN.  But I encounter error message BORGR 637 "Inbound delivery cannot be packed".  This error occurred because item packing status

  • Costs and settled costs layout in standard reports

    Hello guys ! what needs to be done in order to have a report, for example, S_ALR_87013543 , splitted by costs and settled costs (debit/credit) ? I can't find a layout or smth. Thanks guys. Laimonas

  • "ProjectData" can't be found - Logic deleted my project

    Hey guys, When I open my Browser and look at the Project pkg, the project file itself is 800 MB, which means it obviously holds the information within it. But when I open it, Logic Pro X requires me to create a new track, as if I had just opened a ne