Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # app/src/main/resources/appdata.json
This commit is contained in:
commit
1689e2014f
@ -45,7 +45,6 @@ public class StoreProcessor extends Thread implements AutoCloseable {
|
|||||||
this.store = socket;
|
this.store = socket;
|
||||||
this.protocolRep = protocolRep;
|
this.protocolRep = protocolRep;
|
||||||
this.client_run = false;
|
this.client_run = false;
|
||||||
initStore();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +54,7 @@ public class StoreProcessor extends Thread implements AutoCloseable {
|
|||||||
* @see PrintWriter
|
* @see PrintWriter
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
private void initStore() {
|
public void startStore() {
|
||||||
try {
|
try {
|
||||||
this.reader = new BufferedReader(new InputStreamReader(
|
this.reader = new BufferedReader(new InputStreamReader(
|
||||||
this.store.getInputStream(),
|
this.store.getInputStream(),
|
||||||
|
@ -70,13 +70,15 @@ public class MulticastServerListener implements Runnable {
|
|||||||
HelloRule.Result readerResult = protocolRep.executeReader(null, data);
|
HelloRule.Result readerResult = protocolRep.executeReader(null, data);
|
||||||
System.out.printf("Nouveau SBE : Domain=%s | Port=%d\n", readerResult.getDomain(), readerResult.getPort());
|
System.out.printf("Nouveau SBE : Domain=%s | Port=%d\n", readerResult.getDomain(), readerResult.getPort());
|
||||||
|
|
||||||
Socket socket = new Socket(packet.getAddress(), readerResult.getPort());
|
if (!this.repository.hasDomain(readerResult.getDomain())){
|
||||||
|
Socket socket = new Socket(packet.getAddress(), readerResult.getPort());
|
||||||
|
|
||||||
// Create the store processor
|
// Create the store processor
|
||||||
StoreProcessor storeProcessor = new StoreProcessor(socket, readerResult.getDomain(), ffe, protocolRep); // TODO <!!!> : Voir comment on procède get via repo ou ici ?!
|
StoreProcessor storeProcessor = new StoreProcessor(socket, readerResult.getDomain(), ffe, protocolRep); // TODO <!!!> : Voir comment on procède get via repo ou ici ?!
|
||||||
|
|
||||||
// Add the store processor to its repository
|
// Add the store processor to its repository
|
||||||
this.repository.addStore(storeProcessor);
|
this.repository.addStore(storeProcessor);
|
||||||
|
}
|
||||||
} catch (IOException ignore) {
|
} catch (IOException ignore) {
|
||||||
ignore.printStackTrace();
|
ignore.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ public interface MulticastSPR {
|
|||||||
* Add a StorePorcessor.
|
* Add a StorePorcessor.
|
||||||
* @param store Store processor to add.
|
* @param store Store processor to add.
|
||||||
*/
|
*/
|
||||||
void addStore(StoreProcessor store);
|
boolean addStore(StoreProcessor store);
|
||||||
|
|
||||||
String findDomain(Task task);
|
String findDomain(Task task);
|
||||||
|
|
||||||
|
@ -50,9 +50,12 @@ public class StoreProcessorRepository implements AutoCloseable, MulticastSPR {
|
|||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addStore(StoreProcessor store) {
|
public boolean addStore(StoreProcessor store) {
|
||||||
this.handlers.add(store);
|
if (!this.hasDomain(store.getDomain())) {
|
||||||
|
store.startStore();
|
||||||
|
return this.handlers.add(store);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user