Adjust Metrics.

1. Removed setting timeouts explicitly.
2. Schedule logging the error before throwing the exception.
This commit is contained in:
asofold 2013-02-12 22:58:03 +01:00
parent 73cbac3b8f
commit 7d5e5deb24

View File

@ -34,6 +34,8 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
import fr.neatmonster.nocheatplus.logging.LogUtil;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@ -432,9 +434,9 @@ public class Metrics {
} else {
connection = url.openConnection();
}
// NCP: Set timeouts.
connection.setConnectTimeout(8000);
connection.setReadTimeout(16000);
// // NCP: Set timeouts.
// connection.setConnectTimeout(8000);
// connection.setReadTimeout(16000);
connection.setDoOutput(true);
@ -462,6 +464,7 @@ public class Metrics {
}
if (response == null || response.startsWith("ERR")) {
LogUtil.scheduleLogWarning("[NoCheatPlus] Metrics error: " + response);
throw new IOException(response); //Throw the exception
} else {
// Is this the first update this hour?