|
|
|
@ -136,19 +136,18 @@ public class ApplicationPidFileWriter
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onApplicationEvent(SpringApplicationEvent event) {
|
|
|
|
|
if (this.triggerEventType.isInstance(event)) {
|
|
|
|
|
if (created.compareAndSet(false, true)) {
|
|
|
|
|
try {
|
|
|
|
|
writePidFile(event);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
String message = String.format("Cannot create pid file %s",
|
|
|
|
|
this.file);
|
|
|
|
|
if (failOnWriteError(event)) {
|
|
|
|
|
throw new IllegalStateException(message, ex);
|
|
|
|
|
}
|
|
|
|
|
logger.warn(message, ex);
|
|
|
|
|
if (this.triggerEventType.isInstance(event)
|
|
|
|
|
&& created.compareAndSet(false, true)) {
|
|
|
|
|
try {
|
|
|
|
|
writePidFile(event);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
String message = String.format("Cannot create pid file %s",
|
|
|
|
|
this.file);
|
|
|
|
|
if (failOnWriteError(event)) {
|
|
|
|
|
throw new IllegalStateException(message, ex);
|
|
|
|
|
}
|
|
|
|
|
logger.warn(message, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|