- Optimision fermeture resource SBE
This commit is contained in:
parent
92ca17f6df
commit
b60b5ddd55
@ -96,13 +96,13 @@ public class StoreProcessor extends UnicastThread implements AutoCloseable {
|
|||||||
|
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
System.out.println("[ERROR] Problem with SBE (" + domain + ") : " + exception.getMessage());
|
System.out.println("[ERROR] Problem with SBE (" + domain + ") : " + exception.getMessage());
|
||||||
this.close();
|
this.setRunning(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fermeture du SBE
|
// Fermeture du SBE
|
||||||
try {
|
try {
|
||||||
super.close();
|
this.close();
|
||||||
this.fileFrontEnd.onStoreDisconnect(this.domain);
|
this.fileFrontEnd.onStoreDisconnect(this.domain);
|
||||||
} catch (Exception ioException) {
|
} catch (Exception ioException) {
|
||||||
System.out.println("[ERROR] Error while closing SBE (" + domain + ") : " + ioException.getMessage());
|
System.out.println("[ERROR] Error while closing SBE (" + domain + ") : " + ioException.getMessage());
|
||||||
@ -129,7 +129,7 @@ public class StoreProcessor extends UnicastThread implements AutoCloseable {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
this.protocolResult = null;
|
this.protocolResult = null;
|
||||||
if (responseCommand == null) {
|
if (responseCommand == null) {
|
||||||
this.close();
|
this.setRunning(false);
|
||||||
}
|
}
|
||||||
fileFrontEnd.onStoreAvailable(this.getDomain(), responseCommand);
|
fileFrontEnd.onStoreAvailable(this.getDomain(), responseCommand);
|
||||||
}
|
}
|
||||||
@ -148,20 +148,6 @@ public class StoreProcessor extends UnicastThread implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* AutoClosable Function
|
|
||||||
* Close the Storage thread and resources.
|
|
||||||
*
|
|
||||||
* @since 1.0
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void close() {
|
|
||||||
if (this.isRunning()) {
|
|
||||||
this.setRunning(false);
|
|
||||||
System.out.println("[SBE] Fermeture de " + domain);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare two StoreProcessor object to check if equals.
|
* Compare two StoreProcessor object to check if equals.
|
||||||
*/
|
*/
|
||||||
|
@ -78,6 +78,7 @@ public abstract class UnicastThread extends Thread implements AutoCloseable {
|
|||||||
this.reader.close();
|
this.reader.close();
|
||||||
this.writer.close();
|
this.writer.close();
|
||||||
this.socket.close();
|
this.socket.close();
|
||||||
|
setRunning(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isRunning() {
|
protected boolean isRunning() {
|
||||||
|
Loading…
Reference in New Issue
Block a user