public void restartThreads() {
commonThreadPool.restart();
}
private void mainLoop() {
NetworkSystem networkSystem = CoreRegistry.get(NetworkSystem.class);
DisplayDevice display = CoreRegistry.get(DisplayDevice.class);
PerformanceMonitor.startActivity("Other");
// MAIN GAME LOOP
while (running && !display.isCloseRequested()) {
// Only process rendering and updating once a second
if (!display.isActive() && isHibernationAllowed()) {
time.setPaused(true);
Iterator<Float> updateCycles = time.tick();
while (updateCycles.hasNext()) {
updateCycles.next();
}
try {
Thread.sleep(100);
} catch (InterruptedException e) {
logger.warn("Display inactivity sleep interrupted", e);
}
display.processMessages();
time.setPaused(false);
continue;
}
processStateChanges();
if (currentState == null) {
shutdown();
break;
}
Iterator<Float> updateCycles = time.tick();
PerformanceMonitor.startActivity("Network Update");
networkSystem.update();
PerformanceMonitor.endActivity();
long totalDelta = 0;
while (updateCycles.hasNext()) {
float delta = updateCycles.next();