Removed the whole stop method synchronization block in CLIApplication. Not necessary due to the other one at the beginning of the method.

This commit is contained in:
Marc Baloup 2023-08-17 18:04:07 +02:00
parent 378e79b8ad
commit a49061eb9f
1 changed files with 13 additions and 17 deletions

View File

@ -61,28 +61,24 @@ public abstract class CLIApplication {
} }
private final Object stopLock = new Object();
private final AtomicBoolean stopping = new AtomicBoolean(false); private final AtomicBoolean stopping = new AtomicBoolean(false);
@SuppressWarnings("finally") @SuppressWarnings("finally")
public final void stop() { public final void stop() {
synchronized (stopLock) { synchronized (stopping) {
synchronized (stopping) { if (stopping.get())
if (stopping.get()) return;
return; stopping.set(true);
stopping.set(true); }
} Log.info("Stopping " + getName() + " version " + getClass().getPackage().getImplementationVersion());
Log.info("Stopping " + getName() + " version " + getClass().getPackage().getImplementationVersion()); try {
try { end();
end(); } catch (Throwable t) {
} catch (Throwable t) { Log.severe("Error stopping application " + getName() + " version " + getClass().getPackage().getImplementationVersion(), t);
Log.severe("Error stopping application " + getName() + " version " + getClass().getPackage().getImplementationVersion(), t); } finally {
} finally { Log.info("Bye bye.");
Log.info("Bye bye."); System.exit(0);
System.exit(0);
}
} }
} }
public boolean isStopping() { public boolean isStopping() {