Synchronized threadpool arrays.

This commit is contained in:
MobiusDevelopment 2019-06-02 21:17:19 +00:00
parent 242b6fe756
commit 4851af4561
14 changed files with 364 additions and 238 deletions

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {

View File

@ -101,6 +101,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion. * @return a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion.
*/ */
public static ScheduledFuture<?> schedule(Runnable runnable, long delay) public static ScheduledFuture<?> schedule(Runnable runnable, long delay)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -111,6 +113,7 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Creates and executes a periodic action that becomes enabled first after the given initial delay. * Creates and executes a periodic action that becomes enabled first after the given initial delay.
@ -120,6 +123,8 @@ public final class ThreadPool
* @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation. * @return a ScheduledFuture representing pending completion of the task, and whose get() method will throw an exception upon cancellation.
*/ */
public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period) public static ScheduledFuture<?> scheduleAtFixedRate(Runnable runnable, long initialDelay, long period)
{
synchronized (SCHEDULED_POOLS)
{ {
try try
{ {
@ -130,12 +135,15 @@ public final class ThreadPool
return null; return null;
} }
} }
}
/** /**
* Executes the given task sometime in the future. * Executes the given task sometime in the future.
* @param runnable : the task to execute. * @param runnable : the task to execute.
*/ */
public static void execute(Runnable runnable) public static void execute(Runnable runnable)
{
synchronized (INSTANT_POOLS)
{ {
try try
{ {
@ -145,6 +153,7 @@ public final class ThreadPool
{ {
} }
} }
}
public static String[] getStats() public static String[] getStats()
{ {