diff --git a/pom.xml b/pom.xml index 6197fada..5e38dc99 100644 --- a/pom.xml +++ b/pom.xml @@ -192,6 +192,14 @@ jar + + com.sk89q + odeum + 0.2.0-SNAPSHOT + compile + jar + + junit junit @@ -384,6 +392,7 @@ com.jolbox:bonecp org.flywaydb:flyway-core com.sk89q:squirrelid + com.sk89q:odeum @@ -399,6 +408,10 @@ com.sk89q.squirrelid com.sk89q.worldguard.util.profile + + com.sk89q.odeum + com.sk89q.worldguard.internal.odeum + diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java index 70f41bad..deeae98d 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardPlugin.java @@ -29,6 +29,7 @@ import com.sk89q.minecraft.util.commands.MissingNestedCommandException; import com.sk89q.minecraft.util.commands.SimpleInjector; import com.sk89q.minecraft.util.commands.WrappedCommandException; +import com.sk89q.odeum.concurrency.EvenMoreExecutors; import com.sk89q.squirrelid.cache.HashMapCache; import com.sk89q.squirrelid.cache.ProfileCache; import com.sk89q.squirrelid.cache.SQLiteCache; @@ -50,7 +51,6 @@ import com.sk89q.worldguard.protection.GlobalRegionManager; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.util.FatalConfigurationLoadingException; -import com.sk89q.worldguard.util.concurrency.EvenMoreExecutors; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.World; diff --git a/src/main/java/com/sk89q/worldguard/protection/databases/AbstractAsynchronousDatabase.java b/src/main/java/com/sk89q/worldguard/protection/databases/AbstractAsynchronousDatabase.java index 0eac245d..65fce0b7 100644 --- a/src/main/java/com/sk89q/worldguard/protection/databases/AbstractAsynchronousDatabase.java +++ b/src/main/java/com/sk89q/worldguard/protection/databases/AbstractAsynchronousDatabase.java @@ -22,9 +22,9 @@ import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; +import com.sk89q.odeum.concurrency.EvenMoreExecutors; import com.sk89q.worldguard.protection.managers.RegionManager; import com.sk89q.worldguard.protection.regions.ProtectedRegion; -import com.sk89q.worldguard.util.concurrency.EvenMoreExecutors; import javax.annotation.Nullable; import java.util.HashMap; diff --git a/src/main/java/com/sk89q/worldguard/util/concurrency/EvenMoreExecutors.java b/src/main/java/com/sk89q/worldguard/util/concurrency/EvenMoreExecutors.java deleted file mode 100644 index 8eac52e6..00000000 --- a/src/main/java/com/sk89q/worldguard/util/concurrency/EvenMoreExecutors.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * WorldGuard, a suite of tools for Minecraft - * Copyright (C) sk89q - * Copyright (C) WorldGuard team and contributors - * - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU Lesser 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 Lesser General Public License - * for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldguard.util.concurrency; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.LinkedBlockingQueue; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * Even more {@code ExecutorService} factory methods. - */ -public final class EvenMoreExecutors { - - private EvenMoreExecutors() { - } - - /** - * Creates a thread pool that creates new threads as needed up to - * a maximum number of threads, but will reuse previously constructed - * threads when they are available. - * - * @return the newly created thread pool - */ - public static ExecutorService newBoundedCachedThreadPool(int minThreads, int maxThreads, int maxPoolSize) { - ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor( - minThreads, maxThreads, - 60L, TimeUnit.SECONDS, - new LinkedBlockingQueue(maxPoolSize)); - threadPoolExecutor.allowCoreThreadTimeOut(true); - return threadPoolExecutor; - } - - -}