diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_02.5_Underground/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_02.5_Underground/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_03.0_Helios/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_04.0_GrandCrusade/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_08.2_Homunculus/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_10.3_MasterClass/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/threads/ThreadProvider.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/threads/ThreadProvider.java
index c61ff18fae..374dabfe9f 100644
--- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/threads/ThreadProvider.java
+++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.gameserver.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_CT_0_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_1.0/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_1.0/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_1.5_AgeOfSplendor/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.5_Zaken/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.7_Antharas/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.8_SevenSigns/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.9.5_Saviors/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_2.9_SecretOfEmpire/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}
diff --git a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/commons/threads/ThreadProvider.java b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/commons/threads/ThreadProvider.java
index 10118a10eb..80ff396308 100644
--- a/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/commons/threads/ThreadProvider.java
+++ b/L2J_Mobius_Essence_6.3_Crusader/java/org/l2jmobius/commons/threads/ThreadProvider.java
@@ -1,43 +1,73 @@
-/*
- * This file is part of the L2J Mobius project.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
package org.l2jmobius.commons.threads;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;
/**
- * @author Mobius
+ * ThreadFactory implementation that allows setting a thread name prefix, priority, and daemon status when creating new threads.
+ * @author Pantelis Andrianakis
+ * @since October 18th 2022
*/
public class ThreadProvider implements ThreadFactory
{
private final AtomicInteger _id = new AtomicInteger();
private final String _prefix;
+ private final int _priority;
+ private final boolean _daemon;
+ /**
+ * Creates a new ThreadProvider with the specified prefix, normal thread priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ */
public ThreadProvider(String prefix)
{
- _prefix = prefix + " ";
+ this(prefix, Thread.NORM_PRIORITY, false);
}
+ /**
+ * Creates a new ThreadProvider with the specified prefix and daemon status, and normal thread priority.
+ * @param prefix the prefix to be used for thread names
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, boolean daemon)
+ {
+ this(prefix, Thread.NORM_PRIORITY, daemon);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix and priority, and non-daemon threads.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ */
+ public ThreadProvider(String prefix, int priority)
+ {
+ this(prefix, priority, false);
+ }
+
+ /**
+ * Creates a new ThreadProvider with the specified prefix, priority, and daemon status.
+ * @param prefix the prefix to be used for thread names
+ * @param priority the priority of the threads
+ * @param daemon whether the threads should be daemon threads
+ */
+ public ThreadProvider(String prefix, int priority, boolean daemon)
+ {
+ _prefix = prefix + " ";
+ _priority = priority;
+ _daemon = daemon;
+ }
+
+ /**
+ * Creates a new Thread with the specified Runnable object and with the properties defined in this ThreadProvider.
+ * @param runnable the object whose run method is invoked when this thread is started
+ * @return the created Thread
+ */
@Override
public Thread newThread(Runnable runnable)
{
final Thread thread = new Thread(runnable, _prefix + _id.incrementAndGet());
- thread.setPriority(Thread.NORM_PRIORITY);
- thread.setDaemon(false);
+ thread.setPriority(_priority);
+ thread.setDaemon(_daemon);
return thread;
}
}