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

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

Making service wait until it's finished to start again

AViñeta
9-Granite

Making service wait until it's finished to start again

I am creating an app that reads bit values from an opc and calculates an state based on which ones are active. Problem is sometimes they change in pairs at the same time and the subscription that is listening to that runs twice and gives two simultaneous results. Is there any way to make the service wait untils it's finished before running again? It is currently written in java using the thingworx extension library and it's already synchronous.

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

We managed to solve it. using the synchronized word in java already makes that happen. If it still happens "simultaneously" is most likely because it runs too fast. I added a Thread.sleep for 250 milis and worked like a charm. Hope it helps you!

View solution in original post

2 REPLIES 2

Looking for the same issue. Bumped into your thread. Thanks for creating it. Looking forward for solution.

We managed to solve it. using the synchronized word in java already makes that happen. If it still happens "simultaneously" is most likely because it runs too fast. I added a Thread.sleep for 250 milis and worked like a charm. Hope it helps you!

Top Tags