java - Executor service to run every x seconds -
What is the correct way to get an executable service to submit seconds of every x number?
Public Zero Start () {executorService.submit (new Runnabal) (Public Zero Run) {Scheduled Future & lt; Integer> Results = Executable Service Searchules (Value, X, Time) Unit SECONDS);}); } Wrap the content of the method of running in some time (Thread.currentThread (.) Integrated ()) should be a valid approach - if not, how should it be done?
Thanks
Use:
Scheduled ExeterService ses = Executors.newScheduledThreadPool (10); Ses.scheduleAtFixedRate (New Runnabal) {@Override Public Zero () {// some work}}, 0, X, time unit SECONDS); // execute every x seconds
Comments
Post a Comment