Idée test synchronisation

This commit is contained in:
Jérémi N ‘EndMove’ 2022-02-26 12:25:03 +01:00
parent 57a04da453
commit e770760029
Signed by: EndMove
GPG Key ID: 65C4A02E1F5371A4
3 changed files with 35 additions and 3 deletions

View File

@ -9,7 +9,7 @@ public class Task {
private TaskStatus status; private TaskStatus status;
private String command; private String command;
private String client; private String client;
private String store; private String storeDomain;
public Task() { public Task() {

View File

@ -1,4 +1,13 @@
package lightcontainer.interfaces; package lightcontainer.interfaces;
import lightcontainer.domains.StoreProcessor;
public interface StoreProcessorFFE { public interface StoreProcessorFFE {
/**
* Permet à un {@link StoreProcessor} d'avertir le FFE qu'il est disponible
* @param store
*/
void onStoreAvailable(StoreProcessor store);
} }

View File

@ -1,20 +1,43 @@
package lightcontainer.repository; package lightcontainer.repository;
import lightcontainer.domains.ClientHandler;
import lightcontainer.domains.StoreProcessor;
import lightcontainer.domains.Task; import lightcontainer.domains.Task;
import lightcontainer.interfaces.ClientHandlerFFE; import lightcontainer.interfaces.ClientHandlerFFE;
import lightcontainer.interfaces.StoreProcessorFFE; import lightcontainer.interfaces.StoreProcessorFFE;
import java.util.Collections;
import java.util.Deque; import java.util.Deque;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.concurrent.ConcurrentLinkedDeque;
public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE { public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
// Variables // Variables
private Deque<Task> tasks = new LinkedList<>(); private Deque<Task> tasks = new ConcurrentLinkedDeque<>();
private ClientHandlerRepository clientRepository; // TODO -> pourquoi pas une interface ? end private ClientHandlerRepository clientRepository; // TODO -> pourquoi pas une interface ? end
private StoreProcessorRepository storeRepository; // TODO -> pourquoi pas une interface ? end private StoreProcessorRepository storeRepository; // TODO -> pourquoi pas une interface ? end
// Constructor // Constructor
public FileFrontEnd() { public FileFrontEnd(ClientHandlerRepository clientRepo, StoreProcessorRepository storeRepo) {
this.clientRepository = clientRepo;
this.storeRepository = storeRepo;
}
/**
* Appelé quand nouvelle tâche
*/
public void alertStoreProcessors(Task task) {
// On avertit les stor processors d'une nouvelle tâche
}
/**
* Permet à un {@link StoreProcessor} d'avertir le FFE qu'il est disponible
*
* @param store
*/
@Override
public void onStoreAvailable(StoreProcessor store) {
} }
} }