To lock a flow service at runtime

When a flow service is invoked by a scheduler, I want to lock it at runtime so that another instance of the same scheduler does not invokes it again.

Can somebody please suggest me the code implementation(in Developer) for this problem.

Thanks in advance.

1.One can synchronise a service to allow only a single instance to work on it.
Synchronization can be applied to methods\classes in a Java code.

Hence,If there is a possibility of converting that flow service to a java service, this solution should resolve your problem.

  1. We can create a wrapper service(Java service with synchronised method) which can allow only one instance of the scheduler to invoke the flow service.

Hope these suggestions would be some help.

Let me know of any other solution possible.

Thanks.