- Ajout possibilité de faire attendre une tâche après un SBE
This commit is contained in:
parent
6a002327db
commit
308bc783ac
@ -79,9 +79,12 @@ public class StoreProcessor extends Thread implements AutoCloseable {
|
||||
@Override
|
||||
public void run() {
|
||||
this.client_run = true;
|
||||
|
||||
while (this.client_run) {
|
||||
try {
|
||||
waitAction();
|
||||
if (protocolResult == null) { // Si on n'a pas encore la commande à envoyer
|
||||
waitAction();
|
||||
}
|
||||
System.out.println("[SBE] Envoie commande : " + protocolResult.getCommand());
|
||||
|
||||
// Request
|
||||
@ -209,7 +212,6 @@ public class StoreProcessor extends Thread implements AutoCloseable {
|
||||
}
|
||||
|
||||
public boolean canProcessTask() {
|
||||
System.out.println("[OK 2] " + protocolResult + " - " + domain);
|
||||
return this.protocolResult == null; // Vérifier si tâche veut ce SBE
|
||||
}
|
||||
|
||||
|
@ -68,12 +68,11 @@ public class FileFrontEnd implements ClientHandlerFFE, StoreProcessorFFE {
|
||||
|
||||
private void assignOtherTask(StoreProcessor store) {
|
||||
Iterator<Task> it = tasks.iterator();
|
||||
|
||||
while (it.hasNext()) {
|
||||
Task task = it.next();
|
||||
if (task.getDomain() == null && store.canProcessTask()) {
|
||||
storeRepository.assignTask(store.getDomain(), task);
|
||||
task.setDomain(store.getDomain());
|
||||
store.executeCommand(task.getContext(), task.getCommand());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -75,11 +75,22 @@ public class StoreProcessorRepository implements AutoCloseable, MulticastSPR {
|
||||
return null;
|
||||
}
|
||||
|
||||
private StoreProcessor getSBE(String stor) {
|
||||
for (StoreProcessor handler : handlers) {
|
||||
if (handler.getDomain().equals(stor)) {
|
||||
return handler;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignTask(String stor, Task task) {
|
||||
StoreProcessor handler = findSBE();
|
||||
System.out.println("Find stor : " + handler);
|
||||
handler.executeCommand(task.getContext(), task.getCommand());
|
||||
StoreProcessor handler = getSBE(stor);
|
||||
if (handler != null) {
|
||||
handler.executeCommand(task.getContext(), task.getCommand());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,42 +1 @@
|
||||
{
|
||||
"unicast_port": 8000,
|
||||
"multicast_ip": "224.66.66.1",
|
||||
"multicast_port": 15502,
|
||||
"network_interface": "wlp1s0",
|
||||
"tls": true,
|
||||
"storagePath": "/home/benjamin/ffe",
|
||||
"users": [
|
||||
{
|
||||
"name": "benjamin",
|
||||
"password": "$2a$10$I4vHt83CTYuQCP7xvZ04Ne7Vb0cswBiVZhV0n23k9FCxoH0ny9fZG",
|
||||
"aes_key": "mAP6izUBUhBxIkakH2yB/TplhRz1OQV5Fp6HQmhywns=",
|
||||
"files": [
|
||||
{
|
||||
"name": "README.md",
|
||||
"fileNameSalt": "5k8bd3/hn5ehdkCRJ0MGRQ==",
|
||||
"size": 17,
|
||||
"iv": "/sEVBG7kKnMaJcg5Wpz2bQ==",
|
||||
"storage": [
|
||||
"lightcontainerSB02"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "aaaaa",
|
||||
"password": "$2a$10$nDCEDVwbNO/YDQ4qdRcxfuES4.aboluLzWouXXsk6vDoaWocv516W",
|
||||
"aes_key": "kYtwHy9qJBg30WS6axWTFGVE0Ge5kpYiJJlC+COIEI4=",
|
||||
"files": [
|
||||
{
|
||||
"name": "ca.crt",
|
||||
"fileNameSalt": "JmISh065QAtDIePgl8IG2A==",
|
||||
"size": 4207,
|
||||
"iv": "Tg3aeOm1U0hQI1VqSZbAJw==",
|
||||
"storage": [
|
||||
"lightcontainerSB01"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
{"unicast_port":8000,"multicast_ip":"224.66.66.1","multicast_port":15502,"network_interface":"wlp1s0","tls":true,"storagePath":"/home/benjamin/ffe","users":[{"name":"benjamin","password":"$2a$10$I4vHt83CTYuQCP7xvZ04Ne7Vb0cswBiVZhV0n23k9FCxoH0ny9fZG","aes_key":"mAP6izUBUhBxIkakH2yB/TplhRz1OQV5Fp6HQmhywns=","files":[{"name":"README.md","fileNameSalt":"atK0eGo/J8IBOTCpIZpWow==","size":17,"iv":"fXPzefxl0cO4Hf02Qwi+BA==","storage":["lightcontainerSB01"]}]},{"name":"aaaaa","password":"$2a$10$nDCEDVwbNO/YDQ4qdRcxfuES4.aboluLzWouXXsk6vDoaWocv516W","aes_key":"kYtwHy9qJBg30WS6axWTFGVE0Ge5kpYiJJlC+COIEI4=","files":[{"name":"ca.crt","fileNameSalt":"qz6FoPGyJJ8Hy+1LIouvZA==","size":4207,"iv":"8v2H+cOzztD++NXHXw5Ofw==","storage":["lightcontainerSB01"]}]}]}
|
Loading…
Reference in New Issue
Block a user