Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static Thread startLoopThread(final Runnable runnable, final long repeatInterval) {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    runnable.run();
                    if (repeatInterval > 0) {
                        try {
                            Thread.sleep(repeatInterval);
                        } catch (InterruptedException e) {
                            // NOP
                        }
                    }
                }
            }
        });
        thread.start();
        return thread;
    }
}