-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible add a global @SingleUse for spring boot application? #73
Comments
Hi, thanks for feedback and sorry for the delay. If I understand you correctly, you want to add one annotation which would automatically put lock on all scheduled tasks? It is quite easy to implement but I am afraid that it's a bit dangerous. We need a name for each lock and the only way to generated it automatically is to use method signature - ClassName.methodName(). In my opinion it's quite fragile since you can rename the class or the method and when you deploy the change only to part of the cluster, the task will be executed twice. That's why I hesitate to add it. |
Hi, thanks for you reply. As you said, you use a method name as lock signature. Some time we deploy for change part of the cluster in AB test, I think job or task as AB test in application is not suitable. So, if you check some method have specific annotation you automatically disable global annotation. Of course, it's just my opinion. |
Or maybe just provide the lock name in the annotation? Like this:
Of course, users would need to know what to worry about, but IMHO an annotation parameter is more likely to survive than a method signature name. |
@ivaylo5ev This would mean only one task would run, which isn't the desired behavior no? |
@zHaytam , yes it would and this is NOT the desired behaviour indeed. I have misread / misunderstood the initial request, so ignore my comment above. |
Hope add global definition for spring-boot application. For example, if I add annotation at spring boot launch class, will guard all task execute once in nodes:
Thanks for any reply
The text was updated successfully, but these errors were encountered: