Dump to 4.0.0 #4
@ -2,13 +2,14 @@ package fr.altarik.toolbox.task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
public class Scheduler implements Runnable {
|
||||
|
||||
private final List<SchedulerTaskData> tasks;
|
||||
private final Queue<SchedulerTaskData> tasks;
|
||||
private final SendTaskWorkerI worker;
|
||||
|
||||
public Scheduler(SendTaskWorkerI worker, List<SchedulerTaskData> tasks) {
|
||||
public Scheduler(SendTaskWorkerI worker, Queue<SchedulerTaskData> tasks) {
|
||||
this.worker = worker;
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
@ -2,7 +2,8 @@ package fr.altarik.toolbox.task.async;
|
||||
|
||||
import fr.altarik.toolbox.task.*;
|
||||
|
||||
import java.util.Stack;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -14,7 +15,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class AsyncPeriodicTasks implements PeriodicTaskI, AsyncTaskI, SendTaskWorkerI {
|
||||
|
||||
private final ExecutorService worker;
|
||||
private final Stack<SchedulerTaskData> tasks;
|
||||
private final Queue<SchedulerTaskData> tasks;
|
||||
protected final Scheduler scheduler;
|
||||
private final ServerTickListener listener;
|
||||
|
||||
@ -26,7 +27,7 @@ public class AsyncPeriodicTasks implements PeriodicTaskI, AsyncTaskI, SendTaskWo
|
||||
} else {
|
||||
worker = Executors.newFixedThreadPool(numberOfWorker);
|
||||
}
|
||||
tasks = new Stack<>();
|
||||
tasks = new ConcurrentLinkedQueue<>();
|
||||
this.scheduler = new Scheduler(this, tasks);
|
||||
this.listener = new ServerTickListener(scheduler);
|
||||
}
|
||||
|
@ -2,17 +2,17 @@ package fr.altarik.toolbox.task.sync;
|
||||
|
||||
import fr.altarik.toolbox.task.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class PeriodicSyncTask implements PeriodicTaskI, SendTaskWorkerI {
|
||||
|
||||
private final ServerTickListener listener;
|
||||
private final List<SchedulerTaskData> tasks;
|
||||
private final Queue<SchedulerTaskData> tasks;
|
||||
protected final Scheduler scheduler;
|
||||
|
||||
private PeriodicSyncTask() {
|
||||
this.tasks = new ArrayList<>(2);
|
||||
this.tasks = new ConcurrentLinkedQueue<>();
|
||||
this.scheduler = new Scheduler(this, tasks);
|
||||
this.listener = new ServerTickListener(scheduler);
|
||||
}
|
||||
|
@ -2,17 +2,17 @@ package fr.altarik.toolbox.task.sync;
|
||||
|
||||
import fr.altarik.toolbox.task.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
public class SyncTask implements TaskI, SendTaskWorkerI {
|
||||
|
||||
private final ServerTickListener listener;
|
||||
private final List<SchedulerTaskData> tasks;
|
||||
private final Queue<SchedulerTaskData> tasks;
|
||||
protected final Scheduler scheduler;
|
||||
|
||||
private SyncTask() {
|
||||
this.tasks = new ArrayList<>(2);
|
||||
this.tasks = new ConcurrentLinkedQueue<>();
|
||||
this.scheduler = new Scheduler(this, tasks);
|
||||
this.listener = new ServerTickListener(scheduler);
|
||||
}
|
||||
|
@ -8,6 +8,6 @@ loader_version=0.14.12
|
||||
fabric_version=0.70.0+1.19.3
|
||||
|
||||
maven_group=fr.altarik.toolbox
|
||||
maven_version=3.0.1-SNAPSHOT
|
||||
maven_version=4.0.0-SNAPSHOT
|
||||
repo_username=Altarik
|
||||
repo_password=password
|
Loading…
Reference in New Issue
Block a user