#Java method execution interval
7 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @silver oak! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
I'm wondering whether java has a built-in feature, or community suggested method to set an execution interval within the method.
For example, I run method a() with fast indefinite interval sequentially. But I don't want method a() to be executed too many times at a time. I want it to be able to be run every 500ms.
This is similar to python async methods whose decorators can handle time interval buckets(?), so that it would only be able to be executed once in a set interval, throws an error if ran under the set interval time. I'm very sure that the python thing i mentioned is run behind a service (it calls the API with the decorator), but I want to know if it's also possible in Java.
I want to prevent getConnection spam on DriverManager, (it throws ORA-12519) and I might not use other (not call spamming the database) as this is just for my simple local database project.
TIA. (also I'm not sure if this counts as multithreading label)
Damn i'm asking this at 4 AM, I'll open this post tomorrow, I need some sleep
Java method execution interval
ScheduledExecutorService helps you
I'll note and read that later.