clean, constructeur, optimisation pour ne pas attendre un tick pour recréer les futures suivant
This commit is contained in:
@@ -21,6 +21,7 @@ import impl.Scheduler;
|
||||
public class TestAlgoDiffusionAtom {
|
||||
|
||||
static int NB_CANAUX = 3;
|
||||
static int TEST_TIME = 30; // TEST_TIME/6 + TEST_TIME-TEST_TIME/6
|
||||
public static List<Integer>[] rAtom;
|
||||
|
||||
|
||||
@@ -37,8 +38,8 @@ public class TestAlgoDiffusionAtom {
|
||||
Scheduler scheduler = new Scheduler(NB_CANAUX);
|
||||
CapteurImpl c = new CapteurImpl();
|
||||
|
||||
DiffusionAtomique algo = new DiffusionAtomique();
|
||||
algo.capteur = c;
|
||||
DiffusionAtomique algo = new DiffusionAtomique(c);
|
||||
|
||||
c.setAlgoDiffusion(algo);
|
||||
|
||||
for(int i = 0; i<NB_CANAUX; i++){
|
||||
@@ -52,14 +53,20 @@ public class TestAlgoDiffusionAtom {
|
||||
ScheduledExecutorService clock = scheduler.getScheculer();
|
||||
ScheduledFuture<?> future = clock.scheduleAtFixedRate(() -> c.tick(), 0, 500, TimeUnit.MILLISECONDS);
|
||||
|
||||
Thread.sleep(10000);
|
||||
System.out.println("STOP");
|
||||
c.stop(); //arrête la mise à jour du capteur (mais stop pas le tick)
|
||||
System.out.println("waitting for lasts display...");
|
||||
for(int i = 60; i>0; i--){
|
||||
for(int i = TEST_TIME/6; i>0; i--){ //attend que le capteur génère des valeurs
|
||||
System.out.println("restant " + i + "s");
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
System.out.println("STOP");
|
||||
c.stop(); //arrête la mise à jour du capteur (mais stop pas le tick)
|
||||
System.out.println("waitting for lasts display...");
|
||||
|
||||
for(int i = TEST_TIME-TEST_TIME/6; i>0; i--){
|
||||
System.out.println("restant " + i + "s");
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
|
||||
future.cancel(false);
|
||||
|
||||
clock.shutdown();
|
||||
|
||||
Reference in New Issue
Block a user