cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Stop service execution

cscholtz
1-Newbie

Stop service execution

I there a way to stop a service from executing without restarting tomcat?

1 ACCEPTED SOLUTION

Accepted Solutions

No from outside the service. But you can create a property called "stopExecution" (not persistent) and check on each iteration/whatever if it's true or not and exit.

View solution in original post

9 REPLIES 9

No from outside the service. But you can create a property called "stopExecution" (not persistent) and check on each iteration/whatever if it's true or not and exit.

Even if I comment out the old code completely and save it keeps executing. It's like it keeps running the old version. I tried disabling the service and deactivating the Thing. Maybe if I delete it completely, but that seems like overkill.

/*while(me.lock==true)

{

  var milliseconds = pause(1000);

    logger.info('pausing');

}*/

If it let's you save the thing, then the thing should not be running, otherwise it won't let you save the thing. If you restart Tomcat, and look on the service code it's the new code or the old one?

I restarted tomcat, and the code was not commented out anymore (its the old code)!

Then you had a pending transaction behind the scenes, now that it's clean, you can edit it, once restarted all transactions are Ok.

Weird that it let me save then. Thanks for your help!

The reason that it let you "save" I think was as the previous code didn't do a "blocking" on the Thing, as it wasn't interacting with any persistent property, if the previous code did write on a persistent property then it won't let you save....

Well it was checking me.lock which is persistent, but not writing to it yes.

Reading it's not a problem, the blocking condition happens when you write on a persistent property.

Top Tags