From 595e144797aac6c630450fea68ae5de6e23cf821 Mon Sep 17 00:00:00 2001 From: luccioman Date: Thu, 15 Nov 2018 17:32:22 +0100 Subject: [PATCH] Trace a message on incomplete proper server finish when killing process --- source/net/yacy/yacy.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/net/yacy/yacy.java b/source/net/yacy/yacy.java index e02816ab9..cf4985fb3 100644 --- a/source/net/yacy/yacy.java +++ b/source/net/yacy/yacy.java @@ -915,7 +915,10 @@ class shutdownHookThread extends Thread { /* Main thread will release the shutdownSemaphore once completely terminated. * We do not wait indefinitely as the application is supposed here to quickly terminate */ - this.shutdownSemaphore.tryAcquire(30, TimeUnit.SECONDS); + final int maxWaitTime = 30; + if(!this.shutdownSemaphore.tryAcquire(maxWaitTime, TimeUnit.SECONDS)) { + System.out.println("Shutting down JVM. Main thread did not completely finish within " + maxWaitTime + " seconds."); + } } } catch (final Exception e) { ConcurrentLog.severe("SHUTDOWN","Unexpected error. " + e.getClass().getName(),e);