java - Calling a function every 10 minutes -


i'm not expert, beginner. kindly ask write code me.

if have 2 classes, class a , class b, , inside class b there function called funb(). want call function class a every ten minutes.

you have given me ideas, didn't quite understand.

can post example code, please?

have @ scheduledexecutorservice:

here class method sets scheduledexecutorservice beep every ten seconds hour:

 import static java.util.concurrent.timeunit.*;  class beepercontrol {     private final scheduledexecutorservice scheduler =        executors.newscheduledthreadpool(1);      public void beepforanhour() {         final runnable beeper = new runnable() {                 public void run() { system.out.println("beep"); }             };         final scheduledfuture<?> beeperhandle =             scheduler.scheduleatfixedrate(beeper, 10, 10, seconds);         scheduler.schedule(new runnable() {                 public void run() { beeperhandle.cancel(true); }             }, 60 * 60, seconds);     }  } 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -