Idée test synchronisation
This commit is contained in:
parent
57a04da453
commit
e770760029
@ -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() {
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user