Shot down if memory exceeds limits (restart and the sh run loop would trigger more then 1 java instance to get started)

This commit is contained in:
Manfred Karrer 2016-08-13 00:03:43 +02:00
parent 95fece3af3
commit c9129e95af

View file

@ -137,8 +137,13 @@ public class StatisticsMain extends BitsquareExecutable {
final long finalUsedMemoryInMB = usedMemoryInMB; final long finalUsedMemoryInMB = usedMemoryInMB;
UserThread.runAfter(() -> { UserThread.runAfter(() -> {
if (finalUsedMemoryInMB > maxMemory) if (finalUsedMemoryInMB > maxMemory) {
restart(environment); log.error("\n\n############################################################\n" +
"We shut down as we are over our memory limit. usedMemoryInMB: {}" +
"\n############################################################\n\n",
finalUsedMemoryInMB);
System.exit(EXIT_FAILURE);
}
}, 1); }, 1);
} }
}, CHECK_MEMORY_PERIOD_SEC); }, CHECK_MEMORY_PERIOD_SEC);