Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java run code at interval

   /* Perform this runnable code every 5 seconds  in this example*/
   Runnable runnable = new Runnable() {
			public void run() {
				// task to run goes here
				System.out.println("Hello !!");
			}
		};
		ScheduledExecutorService service = Executors
				.newSingleThreadScheduledExecutor();
		service.scheduleAtFixedRate(runnable, 0, 5, TimeUnit.SECONDS);
 
PREVIOUS NEXT
Tagged: #java #run #code #interval
ADD COMMENT
Topic
Name
1+9 =