|
@@ -18,8 +18,10 @@
|
|
*/
|
|
*/
|
|
package com.l2jserver.gameserver;
|
|
package com.l2jserver.gameserver;
|
|
|
|
|
|
-import java.util.logging.Level;
|
|
|
|
-import java.util.logging.Logger;
|
|
|
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
|
+
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.UPnPService;
|
|
import com.l2jserver.UPnPService;
|
|
@@ -54,7 +56,7 @@ import com.l2jserver.gameserver.util.Broadcast;
|
|
*/
|
|
*/
|
|
public class Shutdown extends Thread
|
|
public class Shutdown extends Thread
|
|
{
|
|
{
|
|
- private static final Logger _log = Logger.getLogger(Shutdown.class.getName());
|
|
|
|
|
|
+ private static final Logger _log = LoggerFactory.getLogger(Shutdown.class);
|
|
private static Shutdown _counterInstance = null;
|
|
private static Shutdown _counterInstance = null;
|
|
|
|
|
|
private int _secondsShut;
|
|
private int _secondsShut;
|
|
@@ -84,7 +86,7 @@ public class Shutdown extends Thread
|
|
|
|
|
|
public void startTelnetShutdown(String IP, int seconds, boolean restart)
|
|
public void startTelnetShutdown(String IP, int seconds, boolean restart)
|
|
{
|
|
{
|
|
- _log.warning("IP: " + IP + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
|
|
|
|
|
|
+ _log.warn("IP: {} issued shutdown command. {} in {} seconds!", IP, MODE_TEXT[_shutdownMode], seconds);
|
|
|
|
|
|
if (restart)
|
|
if (restart)
|
|
{
|
|
{
|
|
@@ -135,7 +137,7 @@ public class Shutdown extends Thread
|
|
*/
|
|
*/
|
|
public void telnetAbort(String IP)
|
|
public void telnetAbort(String IP)
|
|
{
|
|
{
|
|
- _log.warning("IP: " + IP + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
|
|
|
|
|
|
+ _log.warn("IP: {} issued shutdown ABORT. {} has been stopped!", IP, MODE_TEXT[_shutdownMode]);
|
|
|
|
|
|
if (_counterInstance != null)
|
|
if (_counterInstance != null)
|
|
{
|
|
{
|
|
@@ -191,11 +193,11 @@ public class Shutdown extends Thread
|
|
try
|
|
try
|
|
{
|
|
{
|
|
UPnPService.getInstance().removeAllPorts();
|
|
UPnPService.getInstance().removeAllPorts();
|
|
- _log.info("UPnP Service: All ports mappings deleted (" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("UPnP Service: All ports mappings deleted ({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
- _log.log(Level.WARNING, "Error while removing UPnP port mappings: ", t);
|
|
|
|
|
|
+ _log.warn("Error while removing UPnP port mappings!", e);
|
|
}
|
|
}
|
|
|
|
|
|
try
|
|
try
|
|
@@ -203,20 +205,20 @@ public class Shutdown extends Thread
|
|
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
|
if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS)
|
|
{
|
|
{
|
|
OfflineTradersTable.getInstance().storeOffliners();
|
|
OfflineTradersTable.getInstance().storeOffliners();
|
|
- _log.info("Offline Traders Table: Offline shops stored(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Offline Traders Table: Offline shops stored({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
- _log.log(Level.WARNING, "Error saving offline shops.", t);
|
|
|
|
|
|
+ _log.warn("Error saving offline shops!", e);
|
|
}
|
|
}
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
disconnectAllCharacters();
|
|
disconnectAllCharacters();
|
|
- _log.info("All players disconnected and saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("All players disconnected and saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
// ignore
|
|
// ignore
|
|
}
|
|
}
|
|
@@ -225,20 +227,20 @@ public class Shutdown extends Thread
|
|
try
|
|
try
|
|
{
|
|
{
|
|
GameTimeController.getInstance().stopTimer();
|
|
GameTimeController.getInstance().stopTimer();
|
|
- _log.info("Game Time Controller: Timer stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Game Time Controller: Timer stopped({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
// ignore
|
|
// ignore
|
|
}
|
|
}
|
|
|
|
|
|
- // stop all threadpolls
|
|
|
|
|
|
+ // stop all thread pools
|
|
try
|
|
try
|
|
{
|
|
{
|
|
ThreadPoolManager.getInstance().shutdown();
|
|
ThreadPoolManager.getInstance().shutdown();
|
|
- _log.info("Thread Pool Manager: Manager has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Thread Pool Manager: Manager has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
// ignore
|
|
// ignore
|
|
}
|
|
}
|
|
@@ -246,9 +248,9 @@ public class Shutdown extends Thread
|
|
try
|
|
try
|
|
{
|
|
{
|
|
LoginServerThread.getInstance().interrupt();
|
|
LoginServerThread.getInstance().interrupt();
|
|
- _log.info("Login Server Thread: Thread interruped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Login Server Thread: Thread interruped({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
// ignore
|
|
// ignore
|
|
}
|
|
}
|
|
@@ -261,9 +263,9 @@ public class Shutdown extends Thread
|
|
try
|
|
try
|
|
{
|
|
{
|
|
GameServer.gameServer.getSelectorThread().shutdown();
|
|
GameServer.gameServer.getSelectorThread().shutdown();
|
|
- _log.info("Game Server: Selector thread has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Game Server: Selector thread has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
// ignore
|
|
// ignore
|
|
}
|
|
}
|
|
@@ -272,9 +274,9 @@ public class Shutdown extends Thread
|
|
try
|
|
try
|
|
{
|
|
{
|
|
ConnectionFactory.getInstance().close();
|
|
ConnectionFactory.getInstance().close();
|
|
- _log.info("L2Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("ConnectionFactory: Database connection has been shut down({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
@@ -289,14 +291,14 @@ public class Shutdown extends Thread
|
|
Runtime.getRuntime().halt(0);
|
|
Runtime.getRuntime().halt(0);
|
|
}
|
|
}
|
|
|
|
|
|
- _log.info("The server has been successfully shut down in " + (tc1.getEstimatedTime() / 1000) + "seconds.");
|
|
|
|
|
|
+ _log.info("The server has been successfully shut down in {}seconds.", TimeUnit.MILLISECONDS.toSeconds(tc1.getEstimatedTime()));
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
// gm shutdown: send warnings and then call exit to start shutdown sequence
|
|
// gm shutdown: send warnings and then call exit to start shutdown sequence
|
|
countdown();
|
|
countdown();
|
|
// last point where logging is operational :(
|
|
// last point where logging is operational :(
|
|
- _log.warning("GM shutdown countdown is over. " + MODE_TEXT[_shutdownMode] + " NOW!");
|
|
|
|
|
|
+ _log.warn("GM shutdown countdown is over. {} NOW!", MODE_TEXT[_shutdownMode]);
|
|
switch (_shutdownMode)
|
|
switch (_shutdownMode)
|
|
{
|
|
{
|
|
case GM_SHUTDOWN:
|
|
case GM_SHUTDOWN:
|
|
@@ -331,7 +333,7 @@ public class Shutdown extends Thread
|
|
_shutdownMode = GM_SHUTDOWN;
|
|
_shutdownMode = GM_SHUTDOWN;
|
|
}
|
|
}
|
|
|
|
|
|
- _log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
|
|
|
|
|
|
+ _log.warn("GM: {}({}) issued shutdown command. {} in {} seconds!", activeChar.getName(), activeChar.getObjectId(), MODE_TEXT[_shutdownMode], seconds);
|
|
|
|
|
|
if (_shutdownMode > 0)
|
|
if (_shutdownMode > 0)
|
|
{
|
|
{
|
|
@@ -375,7 +377,7 @@ public class Shutdown extends Thread
|
|
*/
|
|
*/
|
|
public void abort(L2PcInstance activeChar)
|
|
public void abort(L2PcInstance activeChar)
|
|
{
|
|
{
|
|
- _log.warning("GM: " + activeChar.getName() + "(" + activeChar.getObjectId() + ") issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
|
|
|
|
|
|
+ _log.warn("GM: {}({}) issued shutdown ABORT. {} has been stopped!", activeChar.getName(), activeChar.getObjectId(), MODE_TEXT[_shutdownMode]);
|
|
if (_counterInstance != null)
|
|
if (_counterInstance != null)
|
|
{
|
|
{
|
|
_counterInstance._abort();
|
|
_counterInstance._abort();
|
|
@@ -500,46 +502,43 @@ public class Shutdown extends Thread
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /*
|
|
|
|
- * if (Config.ACTIVATE_POSITION_RECORDER) Universe.getInstance().implode(true);
|
|
|
|
- */
|
|
|
|
TimeCounter tc = new TimeCounter();
|
|
TimeCounter tc = new TimeCounter();
|
|
// Seven Signs data is now saved along with Festival data.
|
|
// Seven Signs data is now saved along with Festival data.
|
|
if (!SevenSigns.getInstance().isSealValidationPeriod())
|
|
if (!SevenSigns.getInstance().isSealValidationPeriod())
|
|
{
|
|
{
|
|
SevenSignsFestival.getInstance().saveFestivalData(false);
|
|
SevenSignsFestival.getInstance().saveFestivalData(false);
|
|
- _log.info("SevenSignsFestival: Festival data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("SevenSignsFestival: Festival data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
|
|
|
|
// Save Seven Signs data before closing. :)
|
|
// Save Seven Signs data before closing. :)
|
|
SevenSigns.getInstance().saveSevenSignsData();
|
|
SevenSigns.getInstance().saveSevenSignsData();
|
|
- _log.info("SevenSigns: Seven Signs data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("SevenSigns: Seven Signs data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
SevenSigns.getInstance().saveSevenSignsStatus();
|
|
SevenSigns.getInstance().saveSevenSignsStatus();
|
|
- _log.info("SevenSigns: Seven Signs status saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("SevenSigns: Seven Signs status saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
|
|
|
|
// Save all raidboss and GrandBoss status ^_^
|
|
// Save all raidboss and GrandBoss status ^_^
|
|
RaidBossSpawnManager.getInstance().cleanUp();
|
|
RaidBossSpawnManager.getInstance().cleanUp();
|
|
- _log.info("RaidBossSpawnManager: All raidboss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("RaidBossSpawnManager: All raidboss info saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
GrandBossManager.getInstance().cleanUp();
|
|
GrandBossManager.getInstance().cleanUp();
|
|
- _log.info("GrandBossManager: All Grand Boss info saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("GrandBossManager: All Grand Boss info saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
ItemAuctionManager.getInstance().shutdown();
|
|
ItemAuctionManager.getInstance().shutdown();
|
|
- _log.info("Item Auction Manager: All tasks stopped(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Item Auction Manager: All tasks stopped({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
Olympiad.getInstance().saveOlympiadStatus();
|
|
Olympiad.getInstance().saveOlympiadStatus();
|
|
- _log.info("Olympiad System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Olympiad System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
Hero.getInstance().shutdown();
|
|
Hero.getInstance().shutdown();
|
|
- _log.info("Hero System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Hero System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
ClanTable.getInstance().storeClanScore();
|
|
ClanTable.getInstance().storeClanScore();
|
|
- _log.info("Clan System: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Clan System: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
|
|
|
|
// Save Cursed Weapons data before closing.
|
|
// Save Cursed Weapons data before closing.
|
|
CursedWeaponsManager.getInstance().saveData();
|
|
CursedWeaponsManager.getInstance().saveData();
|
|
- _log.info("Cursed Weapons Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Cursed Weapons Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
|
|
|
|
// Save all manor data
|
|
// Save all manor data
|
|
if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
|
if (!Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
|
{
|
|
{
|
|
CastleManorManager.getInstance().storeMe();
|
|
CastleManorManager.getInstance().storeMe();
|
|
- _log.info("Castle Manor Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Castle Manor Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
|
|
|
|
CHSiegeManager.getInstance().onServerShutDown();
|
|
CHSiegeManager.getInstance().onServerShutDown();
|
|
@@ -547,19 +546,19 @@ public class Shutdown extends Thread
|
|
|
|
|
|
// Save all global (non-player specific) Quest data that needs to persist after reboot
|
|
// Save all global (non-player specific) Quest data that needs to persist after reboot
|
|
QuestManager.getInstance().save();
|
|
QuestManager.getInstance().save();
|
|
- _log.info("Quest Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Quest Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
|
|
|
|
// Save all global variables data
|
|
// Save all global variables data
|
|
GlobalVariablesManager.getInstance().storeMe();
|
|
GlobalVariablesManager.getInstance().storeMe();
|
|
- _log.info("Global Variables Manager: Variables saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Global Variables Manager: Variables saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
|
|
|
|
// Save items on ground before closing
|
|
// Save items on ground before closing
|
|
if (Config.SAVE_DROPPED_ITEM)
|
|
if (Config.SAVE_DROPPED_ITEM)
|
|
{
|
|
{
|
|
ItemsOnGroundManager.getInstance().saveInDb();
|
|
ItemsOnGroundManager.getInstance().saveInDb();
|
|
- _log.info("Items On Ground Manager: Data saved(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Items On Ground Manager: Data saved({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
ItemsOnGroundManager.getInstance().cleanUp();
|
|
ItemsOnGroundManager.getInstance().cleanUp();
|
|
- _log.info("Items On Ground Manager: Cleaned up(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
|
|
|
|
|
|
+ _log.info("Items On Ground Manager: Cleaned up({}ms).", tc.getEstimatedTimeAndRestartCounter());
|
|
}
|
|
}
|
|
|
|
|
|
// Save bot reports to database
|
|
// Save bot reports to database
|
|
@@ -598,9 +597,9 @@ public class Shutdown extends Thread
|
|
}
|
|
}
|
|
player.deleteMe();
|
|
player.deleteMe();
|
|
}
|
|
}
|
|
- catch (Throwable t)
|
|
|
|
|
|
+ catch (Exception e)
|
|
{
|
|
{
|
|
- _log.log(Level.WARNING, "Failed logour char " + player, t);
|
|
|
|
|
|
+ _log.warn("Failed logour char {}", player, e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|