package cactusServer.utils; import java.util.Timer; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; import org.glassfish.jersey.server.ResourceConfig; import cactusServer.models.Accounts; import cactusServer.models.CharacterModelManager; import cactusServer.models.Instances; import cactusServer.models.StageModelManager; @SuppressWarnings("unused") @ApplicationPath("/rest") public class App extends ResourceConfig implements Runnable { private ScheduledThreadPoolExecutor task = new ScheduledThreadPoolExecutor(4); public App() { StageModelManager.getInstance(); CharacterModelManager.getInstance(); Instances.getInstance(); Accounts.getInstance().createAcount("aaa", "bbb", "c"); start(10000); System.out.println("pass"); } @Override public void run() { System.out.println("タスクを実行"); } public void start(int interval) { task.scheduleWithFixedDelay(this, interval, interval, TimeUnit.MILLISECONDS); } }