Skip to main content
1-Visitor
May 25, 2016
Solved

Stop service execution

  • May 25, 2016
  • 2 replies
  • 5334 views

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

Best answer by CarlesColl

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.

2 replies

1-Visitor
May 25, 2016

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.

cscholtz1-VisitorAuthor
1-Visitor
May 25, 2016

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');

}*/

1-Visitor
May 25, 2016

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?

1-Visitor
May 25, 2016

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....

cscholtz1-VisitorAuthor
1-Visitor
May 25, 2016

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

1-Visitor
May 25, 2016

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