From b7c492c9703d299f881d6db5844e972f4d7e96fe Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 1 Sep 2015 19:47:44 +0800 Subject: [PATCH] synchronized add repo... Signed-off-by: 502647092 --- .../cn/citycraft/Yum/manager/RepositoryManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java index 15e9694..ba90ccc 100644 --- a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java @@ -48,7 +48,7 @@ public class RepositoryManager { plugins.clear(); } - public void updatePackage(Package pkg) { + public synchronized void updatePackage(Package pkg) { for (Plugin plugin : pkg.plugins) { PluginInfo pi = new PluginInfo(); pi.plugin = plugin; @@ -58,12 +58,12 @@ public class RepositoryManager { } } - public void cacheToJson(FileConfiguration config) { + public synchronized void cacheToJson(FileConfiguration config) { config.set("repocache", gson.toJson(repos)); config.set("plugincache", gson.toJson(plugins)); } - public boolean jsonToCache(FileConfiguration config) { + public synchronized boolean jsonToCache(FileConfiguration config) { String repocache = config.getString("repocache"); String plugincache = config.getString("plugincache"); try { @@ -79,7 +79,7 @@ public class RepositoryManager { } } - public boolean updateRepositories(CommandSender sender) { + public synchronized boolean updateRepositories(CommandSender sender) { plugins.clear(); for (String string : repos) { if (addRepositories(string)) { @@ -91,7 +91,7 @@ public class RepositoryManager { return true; } - public boolean addRepositories(String urlstring) { + public synchronized boolean addRepositories(String urlstring) { String json = getHtml(urlstring); if (json == "") { return false; @@ -107,7 +107,7 @@ public class RepositoryManager { return true; } - public boolean addPackage(String urlstring) { + public synchronized boolean addPackage(String urlstring) { String json = getHtml(urlstring); if (json == "") { return false;