RE: Cancelling tasks

How about creating two tasks to solve your problem? One is the main
task which spawns another child task which you are really interested (a
long synchronous task), then the main task goes to the event loop. If
you want to kill the child task, you just use the SetCancel(TaskPolicy =
SH_TP_TASKANDCHILDREN) to kill the main task and the child task.
Hope this helps.
Tien Wang
Indus Consultancy Services
[email protected]
Code example:
Method: mainTask
Start task LongSynchonousTask
Event Loop
when task.Shutdown do
exit;
End Event;
In your program, some where you can call:
aTaskDesc: TaskDesc = Start Task mainTask;
If you need to cancel the task, just do
aTaskDesc.SetCancel(TaskPolicy = SH_TP_TASKANDCHILDREN)
-----Original Message-----
From: owner-forte-users [SMTP:[email protected]]
Sent: Wednesday, September 24, 1997 1:56 PM
To: Forte Newsgroup Submission
Subject: Cancelling tasks
I've tried out some of the suggested implementations for cancelling
tasks using TaskDesc.SetCancel() and CancelException.
This works great when you are cancelling a process that is
executing an event loop. However, how do I cancel a task that
is simply taking too long to complete processing a synchronous
task which is not using an event loop?
THank you,
Keith

We have a situation where the user clicks on a button to start a long
retrieve process. During the retrieve process the task is not in an event
loop. However, the user may wish to cancel the retrieve process at any
point. What we did was to start the retrieve process as a new task with
return and exception events. The main task stores the task handle for
this new task and then displays a new window which has a cancel button.
The main task now runs this window's event loop. If the cancel button is
pressed the setcancel() method is called on the new task's handle.
Besides this the event loop also waits for return & exception events from
the new task. Once any of these happens the event loop is exited and one
goes back to normal processing. We also modified the code of the retrieve
process to catch the CancelException in the exception block. This allows
it to do any clean up required before it terminates.
Hope this helps.
Regards,
Sanjay Murthi
Indus Consultancy Services
[email protected]
From: Keith Kroeger
Sent: Saturday, September 27, 1997 12:04 PM
To: Forte Newsgroup Submission
Cc: murthis; vasasm; chandraa
Subject: Cancelling tasks
MCI Mail date/time: Wed Sep 24, 1997 11:58 am EST
Source date/time: Wed, 24 Sep 1997 13:55:55 -0500
I've tried out some of the suggested implementations for cancelling
tasks using TaskDesc.SetCancel() and CancelException.
This works great when you are cancelling a process that is
executing an event loop. However, how do I cancel a task that
is simply taking too long to complete processing a synchronous
task which is not using an event loop?
THank you,
Keith

Similar Messages

  • How to cancel task which are in Queue state in SCOM console?

    Hi All,
    When I start any task it does not execute. It show task is in queue state. How can I cancel or execute this task?
    Thanks

    To cancel Task, you can use following steps:
    In the Monitoring workspace, expand Operations Manager and then expand
    Agent Details.
    Click Agent Health State.
    In Agent State, click an agent.
    In the Tasks pane, click Flush Health Service State and Cache.
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"

  • Lightroom 5.6 When I try to publish the photos from Lightroom to SmugMug I get an error Canceling task at the top left side and the photos are not published. I have published photos before just last week so not sure whats going on. Any help would be great

    Lightroom 5.6 When I try to publish the photos from Lightroom to SmugMug I get an error Canceling task at the top left side and the photos are not published. I have published photos before just last week so not sure whats going on. Any help would be great.

    See my first post in this topic:
    https://discussions.apple.com/message/21371126#21371126
    Trashing the preference file may help, as I've outlined in the topic I've linked to. Otherwise, follow the steps regarding removing 3rd party QuickTime components. Also, see the final post by the OP (EEye87) regarding how his problem was resolved (a combination of trashing the preference file and the 3ivx component).
    John

  • Trying to print a book with Aperture 2.1.4, everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window.

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

    everything went well until the final step "uploading files to server" -- it's been spinning for an hour, "status" still reads 0%, "pause task" and "cancel task" buttons are grayed out in Activity window. Any ideas?

  • Mark waiting and cancelled tasks completed

    Hi All,
    is there sql somewhere that can mark certain tasks that are in waiting and canceled status to Completed?
    Thanx.
    Fred

    I would suggest using the APIs to update the status or use the manuallyComplete API instead.
    -Kevin

  • Cancel Task Assignment after Exception?

    Hello,
    I'm trying to model a parallel workflow by placing two User Tasks (SimpleWorkflow) in a Flow component.
    The requirement is as soon as one of the two assigned users rejects the task, the process should immediately abort.
    I achieved this by throwing an exception in the Reject branch, and catch it at the top level.
    Now my problem is, when user A says Reject, the exception is thrown and caught, and the process comes to the end, but if user B logs in to the Worklist Application, the task is still visible and pending:(
    This behaviour doesn't seem consistent to me, have a done something wrong? Is there a way to cancel all user tasks assigned in a process as soon as the process ends?
    p.s. I can not use the Parallel Workflow pattern because user A and user B have different view of the workflow data and the JSP has to be designed individually, while in Parallel Workflow pattern, all users have the same view of the data (single JSP).
    Any help will be appreciated and thanks in advance.
    ZHU Jia

    OK, it seems that adding a Terminate at the end of my catch block does the trick.

  • Cancel Task in BPEL human workflow

    All,
    We have a requirement to cancel the task for the user using human work flow. The worklist should be deleted for the user. Let me know if oracle human workflow provides an opertaion option to cancel the task like reassign,initaiate etc.
    Regards,
    M.Rajesh

    Ronald,
    By cancel means i need the worklist entry for the given taskid to be deleted or marked as cancel so that the user will not be able to process the task. The BPEL process should have a human task process defined like updatetask which will cancel the task.
    Let me expalin our scenario.
    We have an assignment which has different status like new,reassign,cancel. Using a switch we check for the required status and if the status is new we call the initaiate task. Similarly if the status is cancel we need to cancel or delete the task for the user.
    Regards,
    M.Rajesh

  • Re: Cancelling a Task

    Hi Daniel,
    Ajith Kallambella said:
    Now to answer your question, if in exception handler, if you handle
    CancelException and do ErrorMgr.Clear(), it will only clear the error
    stack without printing the error message. But the task still remains
    cancelled because task.IsCancelled will still be TRUE. This should cause
    Forte to raise another CancelException again. Forte should keep raising
    the CancelException until the task is actually cancelled and the
    TaskDesc context is done with.
    Some one please correct me if I am wrong.
    The above sounds correct to me.
    Also, if you clear the task.EnableSystemCancel attribute then Forte will
    not raise the CancelException exception and you can instead check the
    IsCancelled flag yourself.
    cya,
    Jace.
    Jason de Cean
    Forte Analyst/Programmer
    Lumley Technology Limited
    111 Devonshire Street
    Surry Hills, Sydney, Australia
    Ph: 02 93186720
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    I should have read the f... manual ;-)
    >
    In Java there is no reliable way to "kill" a thread in process. However, when cancel is called on a Task, it is important that the Task stop processing. A "run-away" Task might continue processing and updating the message, text, and progress properties even after the Task has been cancelled! In Java, cancelling a Task is a cooperative endeavor. The user of the Task will request that it be cancelled, and the author of the Task must check whether is has been cancelled within the body of the call method. There are two ways this can be done. First, the Task author may check the isCancelled method, inherited from FutureTask, to see whether the Task has been cancelled. Second, if the Task implementation makes use of any blocking calls (such as NIO InterruptibleChannels or Thread.sleep) and the task is cancelled while in such a blocking call, an InterruptedException is thrown. Task implementations which have blocking calls should recognize that an interrupted thread may be the signal for a cancelled task and should double check the isCancelled method to ensure that the InterruptedException was thrown due to the cancellation of the Task.

  • Customize a task cancellation message

    I want to customize a task cancellation message rather than the default one "A task was canceled".
    My code:
    static void Main(string[] args)
    CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
    CancellationToken token = cancellationTokenSource.Token;
    Task task = Task.Run(() =>
    while (!token.IsCancellationRequested)
    Console.Write('*');
    Thread.Sleep(1000);
    }, token).ContinueWith((t)=>
    t.Exception.Handle((e)=>true);
    Console.WriteLine("You have canceled the task");
    }, TaskContinuationOptions.OnlyOnCanceled);
    //token.ThrowIfCancellationRequested();
    try
    Console.WriteLine("Press enter to stop the task");
    Console.ReadLine();
    cancellationTokenSource.Cancel();
    //task.Wait();
    catch (AggregateException e)
    Console.WriteLine(e.InnerExceptions[0].Message);
    Console.WriteLine("Press enter to end the application");
    Console.ReadLine();
    The expected task cancellation message is
    You have canceled the task
    My code is not generating it, thanks for help.

    My code? You mean your code. The reason why the "Press enter to end the application" appears before the "You have canceled the task" has nothing do with the fact that the ContinueWith method was never executed which was your original
    question/issue.
    You must wait for the task to complete execution by calling its Wait method before you terminate the application:
    static void Main(string[] args) {
    CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
    CancellationToken token = cancellationTokenSource.Token;
    Task task = Task.Run(() =>
    while (true) {
    token.ThrowIfCancellationRequested();
    Console.Write('*');
    Thread.Sleep(1000);
    }, token).ContinueWith((t) =>
    Console.WriteLine("You have canceled the task");
    }, TaskContinuationOptions.OnlyOnCanceled);
    //token.ThrowIfCancellationRequested();
    try {
    Console.WriteLine("Press enter to stop the task");
    Console.ReadLine();
    cancellationTokenSource.Cancel();
    //task.Wait();
    catch (AggregateException e) {
    Console.WriteLine(e.InnerExceptions[0].Message);
    task.Wait();
    Console.WriteLine("Press enter to end the application");
    Console.ReadLine();
    Please remember to close the thread by marking all helpful posts as answer.

  • Cancel A Selected task in ServiceManger

    Cancel A Selected task in ServiceManger
    How can I cancel only a single task without affecting the other tasks in the delivery plan ?
    The following will allow you to cancel any tasks having a supervisor, without affecting the remaining tasks in the Plan.
    1. Assign a supervisor for any plan task you may want to cancel. Do this in the Plan tab/Participants sub-tab.
    Assign the supervisor from any of the 3 methods - Person/Queue, Position, or Expression.
    2. In Site Administration, set to ON the Configuration Tab setting for Allow Task Supervisors To Cancel Tasks.

    you could develop a subclass of Timer that stores a list of all scheduled TimerTask instances. Then retrieve the instance that you want to cancel:
    TimerTask [] tasks = timer.getScheduledTasks();
    tasks[0].cancel();
    .... you would have to make sure it works (that the TimerTask is actually canceled and not executed), but the code would be easy- just over-ride each schedule method so that it adds the current TimerTask argument to the list of all tasks... .... I would imagine that sun has a reason for not providing that functionality. They may want to avoid security concerns about having a separate Object cancel tasks- or perhaps the reason has some thing to do with how the tasks are schedule on the machine.... ... you might be able to find an answer in the source code of Timer or TimerTask (src.jar in your SDK folder).

  • Cancel Remote Tasks in InTune

    I will try to keep this as brief as possible.
    We have a spare computer that runs in our supply closet that I mainly use for myself as a NAS. I scheduled a Full Malware Scan on it as I was playing with remote tasks and since that computer isn't being used by one of my users, I wanted to use it as a test
    subject. I started the scan in the morning and the morning following, the computer would be frozen. So I forced a reboot on the computer and the full scan would start again. And of course next morning, the computer was frozen again. It seems to lockup at some
    point in the scan well after I leave for the day. The computer isn't that important for me to look into nor do I have the time right now so I just want to cancel the remote task but I do not see ANYWHERE in which to do so. This is holding up other remote tasks
    from starting as it looks like only 2 task can run at a time which now limits down to one. I have a long queue of remote tasks and well you can see my issue. Can I note cancel a remote task once it has been started? Is the only way to remove Intune from this
    computer? Also, is there anyway I can force Queued items to start? I don't know why they are queued and not running to begin with.

    Hi,
    Tasks can only run one at a time, in the order you run them.  For example, if you run a full scan, a reboot will wait until the full scan finishes or if you cancel it on the machine itself.
    You cannot cancel tasks that have been executed or queued.
    I would log in to the machine, cancel that full scan while it's running from the Endpoint UI, the machine will then report back that the scan has been cancelled and then the other tasks will proceed.
    Thanks.
    Jon L. - MSFT - This posting is provided "AS IS" with no warranties and confers no rights.

  • Tasks are "Cancelled" but resource still "Provisioning"

    Hello.
    There is an annoying thing happening in xlWebApp. In a User's resource profile, I have canceled tasks that have had an error (for various reasons such as couldn't connect to IT resource or incomplete form). However, the main resource profile screen still shows "provisioning" next to these users. How can I remove or change those to say "Revoked" if that's possible at all?
    Thanks.
    Justin

    I have canceled -> How did you that ? ?
    *1)* If using API's then the main Object Status has got nothing to do with the individual tasks.
    *2)* And if you have inserted a revoke task like Delete User/Revoke User by clicking the revoke button then also this task must not have been completed because the delete operation could not have been performed on the actual target systems and the status of this task must be Rejected, so in this case the main status is Provisioning because the Delete/Revoke User is not in a completed state.

  • Re: Asychronous tasks

    On 18 Sep 1997 08:29:08 GMT, MARK NICHOLS wrote:
    I have a window that starts a number of asychronous tasks. One of
    these tasks in particular can take a long time (1-2 minutes) to complete
    depending on the current data in the workflow. If the user closes the
    window before this tasks completes I get the following message:
    USER ERROR: The Shutdown event was post on the task. The task is
    not registered for the event and is therefore cancelled.
    I have put taskDesc objects on all the asychronously started tasks and in
    the task.Shutdown event of the window I, after checking to make sure
    the handle isn't NIL, issue a
    taskDesc.PostShutdown(SH_TP_TASKANDCHILDREN). This seemed to
    clear up the problem.I'll admit first off that I haven't done a whole lot of detailed work
    with asynch tasks in Forte, so I'm not going to have any answers for
    you, but I am curious about what you're describing. For one thing, I
    don't understand why the "taskDesc.PostShutdown" code that you added
    cleared up the problem. The exception you got said that the shutdown
    event had been posted on a task that wasn't registered for it; all
    you've done is post the shutdown event on that task a second time, so I
    don't understand why you wouldn't still get that exception.
    Dale

    We have a situation where the user clicks on a button to start a long
    retrieve process. During the retrieve process the task is not in an event
    loop. However, the user may wish to cancel the retrieve process at any
    point. What we did was to start the retrieve process as a new task with
    return and exception events. The main task stores the task handle for
    this new task and then displays a new window which has a cancel button.
    The main task now runs this window's event loop. If the cancel button is
    pressed the setcancel() method is called on the new task's handle.
    Besides this the event loop also waits for return & exception events from
    the new task. Once any of these happens the event loop is exited and one
    goes back to normal processing. We also modified the code of the retrieve
    process to catch the CancelException in the exception block. This allows
    it to do any clean up required before it terminates.
    Hope this helps.
    Regards,
    Sanjay Murthi
    Indus Consultancy Services
    [email protected]
    From: Keith Kroeger
    Sent: Saturday, September 27, 1997 12:04 PM
    To: Forte Newsgroup Submission
    Cc: murthis; vasasm; chandraa
    Subject: Cancelling tasks
    MCI Mail date/time: Wed Sep 24, 1997 11:58 am EST
    Source date/time: Wed, 24 Sep 1997 13:55:55 -0500
    I've tried out some of the suggested implementations for cancelling
    tasks using TaskDesc.SetCancel() and CancelException.
    This works great when you are cancelling a process that is
    executing an event loop. However, how do I cancel a task that
    is simply taking too long to complete processing a synchronous
    task which is not using an event loop?
    THank you,
    Keith

  • How do I fully cancel a synchronization with flickr? How do I clean up my get my Aperture library to accurately reflect what's on Flickr?

    I went to add one photo to my Flickr site yesterday and I must have had the whole project selected because it started to upload all 635 photos in the project. I realized this about an hour later when I came back and I managed to pause the synchronization, but I can't seem to cancel it. Clicking on Cancel Task doesn't do anything.
    I need to cancel the rest of the synchronization, and then what I would like to do is somehow make sure that what I've chosen to be in my Flickr account is what Aperture thinks should be in Flickr account.
    I went into my Flickr account and deleted all of the ones I didn't want. I ended up keeping more than the one I intended to upload, but I sure didn't want all of them. So, right now, the Flickr account is correct, but my Aperture Flickr library is probably all screwed up. How do I clean up my Aperture library to accurately reflect what's in Flickr?
    Before I just upgraded to the latest version (after upgrading to Mountain Lion) when I tried to synch to the main Flickr set I've been working in, I got a message saying that Aperture could only add the first 500 photos (I only had about 110 photos in the set), so I'm wondering if I had already somehow accidentally added everything at that point, but it wouldn't do it, then I upgraded and now it's trying to synch everything.
    OS: Mountain Lion
    Aperture: 3.3.2
    Thanks.

    I went to add one photo to my Flickr site yesterday and I must have had the whole project selected because it started to upload all 635 photos in the project. I realized this about an hour later when I came back and I managed to pause the synchronization, but I can't seem to cancel it. Clicking on Cancel Task doesn't do anything.
    I need to cancel the rest of the synchronization, and then what I would like to do is somehow make sure that what I've chosen to be in my Flickr account is what Aperture thinks should be in Flickr account.
    I went into my Flickr account and deleted all of the ones I didn't want. I ended up keeping more than the one I intended to upload, but I sure didn't want all of them. So, right now, the Flickr account is correct, but my Aperture Flickr library is probably all screwed up. How do I clean up my Aperture library to accurately reflect what's in Flickr?
    Before I just upgraded to the latest version (after upgrading to Mountain Lion) when I tried to synch to the main Flickr set I've been working in, I got a message saying that Aperture could only add the first 500 photos (I only had about 110 photos in the set), so I'm wondering if I had already somehow accidentally added everything at that point, but it wouldn't do it, then I upgraded and now it's trying to synch everything.
    OS: Mountain Lion
    Aperture: 3.3.2
    Thanks.

  • Task-flow for inserting a record in a popup: error on primary key.

    Hi all,
    I am using Jdeveloper 11.1.1.2.
    I am trying to display a bounded task flow in a popup launched from a page. I am following the steps in: http://www.oracle.com/technology/products/jdev/tips/fnimphius/popupinuishell/declarative_popup_in_uishell.html
    I have a view object (myVO) and I have a page (page1), where I can edit the records of myVO. In this page I have a button that launches (in a window) a task-flow (insertTF, that uses existing transaction if possible, composed by page2 and page3) where I can insert a new record in two step (using a train).
    At the end of the train I can save or cancel (task flow return activity) the inserting record.
    The button cancel work well, but the button save does not. When I click on it, I return in page1 but I have this error: Error: another user modified row with primary key oracle.jbo.Key [[+numberOfKey+]].
    If I see the database navigator or I refresh the page, I can see the record just inserted.
    How can I do to remove this error?
    Thank you
    Andrea
    Edited by: Andrea9 on 10-dic-2009 06:39

    There are default values coming from the DB. There are also default values that I have setted in myModel on myEO.
    I am the only user manages the database, there are no other users.
    So, how can I solve this problem? Have I to remove the default value on inserting? From DB or from myEO?
    thanks in advance
    Andrea

Maybe you are looking for

  • Key Fields, Data Fields, Key Figures and Characteristis, Dimesions & Key Fi

    Hi All, Can any one please describe more about the below terms and with the Example.... Like when we identify which one is Key filelds and Data fileds, how to distingush creating new dimesions (Is it based on user reporting) Key figures in Dimestions

  • Is the iPhone 5 in UAE missing any features?

    Hi guys, As far as anyone of you know is the iPhone 5 (and/or iOS in general) missing any features if bought from the UAE?? Because as I recall at some point the iPhone 4 or 4S didn't offer FaceTime in UAE, so that's why I am asking!! Thank you

  • Setting for the ethernet internet connection

    I was using airport extreme. I don't think it is working and wanted to use the blue cable(ethernet, I think) How do I change the settings to connect to the internet directly?

  • ABAP Code Changes During Upgrade from 4.7C to ECC6

    Hi all, I'm in process of collecting information for our next upgrade. We are on 4.7C and are planning to upgrade to ECC6. We wanted to know what changes shall be required on ABAP side during this upgrade. e.g. certain ABAP commands which are obselet

  • Lightroom 4.4 will not open despite deleting .lock file

    I have deleted the .lock files already but am still getting "light room cannot be opened because another application has it opened" Help!!  I read on the forum to delete the .lock file but nothing seems to be working.