Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
14 replies Latest Post - ‏2012-05-07T18:33:27Z by kolban
jmac_EmeriCon
jmac_EmeriCon
279 Posts
ACCEPTED ANSWER

Pinned topic Process Instance Termination

‏2011-10-25T14:56:24Z |
I am attempting to terminate an instance using ProcessInstance.abort(). The API call seems to work (i.e. the instance does get terminated) but it always throws the following exception:


dispose() called but runner on top of stack not 

this runner.  Need to enable trace to get runner creation location.


I have looked for an explanation but have not found one as of yet.

Any help will be appreciated.

John


_______________________________________________________________________

John McDonald

EmeriCon, LLC
Updated on 2012-05-07T18:33:27Z at 2012-05-07T18:33:27Z by kolban
  • YFEN_gongyao_zheng
    YFEN_gongyao_zheng
    4 Posts
    ACCEPTED ANSWER

    Re: Process Instance Termination

    ‏2011-11-07T16:55:40Z  in response to jmac_EmeriCon
    I got the samen problem, could anybody answer the question?
    • kolban
      kolban
      3315 Posts
      ACCEPTED ANSWER

      Re: Process Instance Termination

      ‏2011-11-07T19:07:17Z  in response to YFEN_gongyao_zheng
      What release of the product are y'all using?

      Neil
      • YFEN_gongyao_zheng
        YFEN_gongyao_zheng
        4 Posts
        ACCEPTED ANSWER

        Re: Process Instance Termination

        ‏2011-11-07T19:11:43Z  in response to kolban
        i am using 7.2.
        • kolban
          kolban
          3315 Posts
          ACCEPTED ANSWER

          Re: Process Instance Termination

          ‏2011-11-08T02:35:02Z  in response to YFEN_gongyao_zheng
          Where are you getting the ProcessInstance object from? Can you post some sample code? Are you trying to abort the current process instance (i.e. the one in which the code is running) or are you trying to abort another instance of a process? What is your functional intent in calling abort?

          Neil
          • YFEN_gongyao_zheng
            YFEN_gongyao_zheng
            4 Posts
            ACCEPTED ANSWER

            Re: Process Instance Termination

            ‏2011-11-08T09:37:56Z  in response to kolban
            when I am trying to abort another instance from the current instance with following code, the error occured. 1000 is the instance id which I want to abort.
            tw.system.findProcessInstanceByID("1000").abort();
            When i try to abort the current instance, it is working fine, no error occured.
            tw.system.currentProcessInstance.abort();
          • jmac_EmeriCon
            jmac_EmeriCon
            279 Posts
            ACCEPTED ANSWER

            Re: Process Instance Termination

            ‏2011-11-08T14:14:38Z  in response to kolban
            I am getting the instance from a TWSearch. The code runs in a separate Human Task (eventually will be a portal page). The same code runs suspend and resume just fine, so this is definitely something in the abort api call (my opinion).

            John


            _______________________________________________________________________

            John McDonald

            EmeriCon, LLC
            • SystemAdmin
              SystemAdmin
              7615 Posts
              ACCEPTED ANSWER

              Re: Process Instance Termination

              ‏2011-11-08T16:48:49Z  in response to jmac_EmeriCon
              Try calling suspend prior to the abort. Not sure that will fix it, but it is worth a try.
              • YFEN_gongyao_zheng
                YFEN_gongyao_zheng
                4 Posts
                ACCEPTED ANSWER

                Re: Process Instance Termination

                ‏2011-11-08T22:13:05Z  in response to SystemAdmin
                i have tried this, but it is the same result.
              • jmac_EmeriCon
                jmac_EmeriCon
                279 Posts
                ACCEPTED ANSWER

                Re: Process Instance Termination

                ‏2011-11-08T22:43:40Z  in response to SystemAdmin
                I changed my code to look like this
                
                
                
                for (var i = 0; i < tw.local.selectedTaskNumbers.listLength; i++) 
                {   var instance = tw.system.findTaskByID(tw.local.selectedTaskNumbers[i]).processInstance; instance.suspend(); instance.abort(); 
                }
                


                IMO, I only go through the loop once since only 1 task was selected.

                I still get the same errors. I attached the stack trace for what it is worth.

                Thanks for the help

                John


                _______________________________________________________________________

                John McDonald

                EmeriCon, LLC
                • kolban
                  kolban
                  3315 Posts
                  ACCEPTED ANSWER

                  Re: Process Instance Termination

                  ‏2011-11-09T03:19:55Z  in response to jmac_EmeriCon
                  I am going to make a "guess" that the abort() method is only allowed to be called (from JavaScript) in the context of the process to be aborted. I.e. we can have a process "commit suicide" but we can't "murder another process" (sorry for the prose). I could be far, far wrong here ... but that would seem to match what we are all seeing. I also wonder where the security permissions for process instance termination exist? Who is allowed to terminate which process instances?

                  Is there a REST API that can be called to terminate a process instance?

                  Neil
                  • JoelKris
                    JoelKris
                    26 Posts
                    ACCEPTED ANSWER

                    Re: Process Instance Termination

                    ‏2011-11-18T19:20:16Z  in response to kolban
                    tw.system.findProcessInstanceByID("100").abort(); works fine in 7.5

                    You will get an error in the designer that findProcessInstanceByID IS UNKNOWN but you can just proceed implementing them.
                • SystemAdmin
                  SystemAdmin
                  7615 Posts
                  ACCEPTED ANSWER

                  Re: Process Instance Termination

                  ‏2011-11-28T06:10:23Z  in response to jmac_EmeriCon
                  I too had a similar requirement to allow admin role user to kill instances from a standalone service under My Project link. As using abort API was always showing the error page despite catching and burying the exception, I had to change the process design and make use of UCA to get the job done. This was a tedious task, but a cleaner approach.

                  Another option that is not so clean is to add an adhoc start node in the BPD and directly end it. Then in the service to terminate the instance, use the process instance variable to get the node reference and invoke it. I had tested this approach too and it worked on WLE 7.1

                  Hope this helps to folks who are using v7.2 or lower.

                  Regards,
                  RM
                  • praveenkd
                    praveenkd
                    8 Posts
                    ACCEPTED ANSWER

                    Re: Process Instance Termination

                    ‏2012-05-07T18:28:12Z  in response to SystemAdmin
                    Hi
                    Can you please explain how you terminated instance using UCA? Did you create intermediate messae event on bpd ?
                    • kolban
                      kolban
                      3315 Posts
                      ACCEPTED ANSWER

                      Re: Process Instance Termination

                      ‏2012-05-07T18:33:27Z  in response to praveenkd
                      Hi there,
                      You can send a message to a process instance using UCA. What the process does when it receives the event is up to you but could include killing itself.

                      There are alternate ways (I think). For example, you could use an Ad-Hoc event or you could use the REST API to terminate the process. I think the bigger question is "What do you want to use and what do you want to happen?"

                      Neil