public void addSelector(Selector selector) { synchronized (LOCK) { if (!this.selectors.contains(selector)) { this.selectors.add(selector); PollTask pollTask = new PollTask(selector); this.pollTasks.add(pollTask); ScheduledFuture<?> future = this.scheduler.scheduleWithFixedDelay(pollTask, 0L, 2L, TimeUnit.MILLISECONDS); this.pollTaskFutures.add(future); } } }
public void addSelector(Selector selector) { synchronized (LOCK) { if (!this.selectors.contains(selector)) { this.selectors.add(selector); PollTask pollTask = new PollTask(selector); this.pollTasks.add(pollTask); ScheduledFuture<?> future = this.scheduler.scheduleWithFixedDelay(pollTask, 0L, 2L, TimeUnit.MILLISECONDS); this.pollTaskFutures.add(future); } } }
private void generateTasks() throws IOException { for (int i = 0; i < ServiceScheduler.POOL_SIZE; i++) { this.selectors.add(SelectorProvider.provider().openSelector()); PollTask pollTask = new PollTask(this.selectors.get(i)); this.pollTasks.add(pollTask); ScheduledFuture<?> future = this.scheduler.scheduleWithFixedDelay(pollTask, 0L, 2L, TimeUnit.MILLISECONDS); this.pollTaskFutures.add(future); } }
private void generateTasks() throws IOException { for (int i = 0; i < ServiceScheduler.POOL_SIZE; i++) { this.selectors.add(SelectorProvider.provider().openSelector()); PollTask pollTask = new PollTask(this.selectors.get(i)); this.pollTasks.add(pollTask); ScheduledFuture<?> future = this.scheduler.scheduleWithFixedDelay(pollTask, 0L, 2L, TimeUnit.MILLISECONDS); this.pollTaskFutures.add(future); } }