Commit 4e09736e authored by Kenix Whisperwind's avatar Kenix Whisperwind

Identifying threads by Server name

parent d68bc4e1
......@@ -25,7 +25,7 @@ public class PlayerDatabaseExecutor extends ThrottleFilter implements Runnable {
*/
private static final Logger LOGGER = LogManager.getLogger();
private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("PlayerDataProcessorThread").build());
private final ScheduledExecutorService scheduledExecutor;
private Queue<LoginRequest> loadRequests = new ConcurrentLinkedQueue<LoginRequest>();
......@@ -45,6 +45,7 @@ public class PlayerDatabaseExecutor extends ThrottleFilter implements Runnable {
public PlayerDatabaseExecutor(Server server) {
this.server = server;
this.database = new DatabasePlayerLoader(getServer());
scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat(getServer().getName()+" : PlayerDataProcessorThread").build());
}
@Override
......
......@@ -98,7 +98,7 @@ public final class Server implements Runnable {
tickEventHandler = new GameTickEventHandler(this);
gameUpdater = new GameStateUpdater(this);
monitoring = new MonitoringEvent();
scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("GameThread").build());
scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat(getName()+" : GameThread").build());
}
public static void main(String[] args) throws IOException {
......
......@@ -35,16 +35,15 @@ public class Market implements Runnable {
public Market() {
auctionItems = new ArrayList<>();
scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat(Server.getServer().getName()+" : AuctionHouseThread").build());
start();
}
public static Market getInstance() {
if (!Server.getServer().getConfig().SPAWN_AUCTION_NPCS) return null;
if (instance == null) {
instance = new Market();
instance.scheduledExecutor = Executors
.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("AuctionHouseThread").build());
instance.start();
}
return instance;
}
......
......@@ -20,7 +20,7 @@ import java.util.concurrent.TimeUnit;
public class DiscordService implements Runnable{
private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat("DiscordServiceThread").build());
private final ScheduledExecutorService scheduledExecutor;
private Queue<String> auctionRequests = new ConcurrentLinkedQueue<String>();
private Queue<String> monitoringRequests = new ConcurrentLinkedQueue<String>();
......@@ -33,6 +33,8 @@ public class DiscordService implements Runnable{
public DiscordService(Server server) {
this.server = server;
scheduledExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactoryBuilder().setNameFormat(getServer().getName()+" : DiscordServiceThread").build());
}
public final Server getServer() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment