Code example for ScheduledExecutorService

Methods: submit

0
public class TaskManager { 
 
	private ScheduledExecutorService eService = Executors.newScheduledThreadPool(Settings.SERVER_THREAD_COUNT);
 
	public void assignProcessor(Runnable r) {
		eService.submit(r);
	} 
 
	public void scheduledProcessor(Runnable r, int time) {
		eService.schedule(r, time, TimeUnit.MILLISECONDS);
	} 
 
	public void checkAndBlockThread() { 
		boolean going = false;
		if(Server.getServer().isUpdating()) { 
			while(Server.getServer().isUpdating()) { 
				if(going != true) {
					System.out.println("Waiting for update to finish! " + Thread.currentThread().getName());
					going = true;
				} 
Experience pair programming with AI  Get Codota for Java