Remove some Useless debug information

This commit is contained in:
Rsl1122 2017-08-12 12:45:08 +03:00
parent 9e78f62267
commit 0a74e37122
12 changed files with 18 additions and 83 deletions

View File

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.2">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../Abstract-Plugin-Framework/AbstractPluginFramework/target/AbstractPluginFramework.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.djrapitops:abstract-plugin-framework:2.0.3">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../Abstract-Plugin-Framework/AbstractPluginFramework/target/AbstractPluginFramework.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.3/abstract-plugin-framework-2.0.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/djrapitops/abstract-plugin-framework/2.0.3/abstract-plugin-framework-2.0.3-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -145,7 +145,7 @@ public class DataCacheHandler extends SessionCache {
} }
try { try {
periodicTaskIsSaving = true; periodicTaskIsSaving = true;
Log.debug("Database", "Periodic Cache Save"); Log.debug("Database", "Periodic Cache Save: " + dataCache.size());
handler.saveHandlerDataToCache(); handler.saveHandlerDataToCache();
handler.saveCachedUserData(); handler.saveCachedUserData();
if (timesSaved % clearAfterXsaves == 0) { if (timesSaved % clearAfterXsaves == 0) {
@ -342,7 +342,7 @@ public class DataCacheHandler extends SessionCache {
return; return;
} }
try { try {
Log.debug("Database", "Periodic TPS Save"); Log.debug("Database", "Periodic TPS Save: " + averages.size());
db.getTpsTable().saveTPSData(averages); db.getTpsTable().saveTPSData(averages);
} catch (SQLException ex) { } catch (SQLException ex) {
Log.toLog(this.getClass().getName(), ex); Log.toLog(this.getClass().getName(), ex);

View File

@ -537,10 +537,8 @@ public abstract class SQLDB extends Database {
if (uuid == null) { if (uuid == null) {
return; return;
} }
setStatus("Save userdata: " + uuid); Log.debug("Database", "Save userdata: " + uuid);
checkConnection(); checkConnection();
Log.debug("Database", "DB_Save:");
Log.debug("Database", data.toString());
data.access(); data.access();
usersTable.saveUserDataInformation(data); usersTable.saveUserDataInformation(data);
int userId = usersTable.getUserId(uuid.toString()); int userId = usersTable.getUserId(uuid.toString());

View File

@ -6,7 +6,6 @@ import main.java.com.djrapitops.plan.data.time.GMTimes;
import main.java.com.djrapitops.plan.database.Container; import main.java.com.djrapitops.plan.database.Container;
import main.java.com.djrapitops.plan.database.DBUtils; import main.java.com.djrapitops.plan.database.DBUtils;
import main.java.com.djrapitops.plan.database.databases.SQLDB; import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
@ -201,8 +200,6 @@ public class GMTimesTable extends Table {
return; return;
} }
Benchmark.start("Save GMTimes");
Set<Integer> savedIDs = getSavedIDs(); Set<Integer> savedIDs = getSavedIDs();
Map<Integer, GMTimes> gmTimes = new HashMap<>(); Map<Integer, GMTimes> gmTimes = new HashMap<>();
@ -231,7 +228,6 @@ public class GMTimesTable extends Table {
gamemodeTimes.keySet().removeAll(savedIDs); gamemodeTimes.keySet().removeAll(savedIDs);
addNewGMTimesRows(gamemodeTimes); addNewGMTimesRows(gamemodeTimes);
Benchmark.stop("Database", "Save GMTimes");
} }
private void saveGMTimesBatch(List<Container<GMTimes>> batch) throws SQLException { private void saveGMTimesBatch(List<Container<GMTimes>> batch) throws SQLException {
@ -274,7 +270,6 @@ public class GMTimesTable extends Table {
statement.addBatch(); statement.addBatch();
} }
Log.debug("Database", "Executing GM Times batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} finally { } finally {
close(statement); close(statement);
@ -286,8 +281,6 @@ public class GMTimesTable extends Table {
return; return;
} }
Benchmark.start("Add GMTimes Rows");
Map<Integer, GMTimes> gmTimes = new HashMap<>(); Map<Integer, GMTimes> gmTimes = new HashMap<>();
for (Map.Entry<Integer, Map<String, Long>> entrySet : gamemodeTimes.entrySet()) { for (Map.Entry<Integer, Map<String, Long>> entrySet : gamemodeTimes.entrySet()) {
@ -305,8 +298,6 @@ public class GMTimesTable extends Table {
Log.toLog("GMTimesTable.addNewGMTimesRows", e); Log.toLog("GMTimesTable.addNewGMTimesRows", e);
} }
}); });
Benchmark.stop("Database", "Add GMTimes Rows");
} }
private void addNewGMTimesBatch(List<Container<GMTimes>> batch) throws SQLException { private void addNewGMTimesBatch(List<Container<GMTimes>> batch) throws SQLException {
@ -343,7 +334,6 @@ public class GMTimesTable extends Table {
statement.addBatch(); statement.addBatch();
} }
Log.debug("Database", "Executing GM Times batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} finally { } finally {
close(statement); close(statement);

View File

@ -74,7 +74,6 @@ public class IPsTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public List<InetAddress> getIPAddresses(int userId) throws SQLException { public List<InetAddress> getIPAddresses(int userId) throws SQLException {
Benchmark.start("Get Ips");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -95,7 +94,6 @@ public class IPsTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "Get Ips");
} }
} }
@ -109,7 +107,6 @@ public class IPsTable extends Table {
return; return;
} }
Benchmark.start("Save Ips");
ips.removeAll(getIPAddresses(userId)); ips.removeAll(getIPAddresses(userId));
if (ips.isEmpty()) { if (ips.isEmpty()) {
@ -141,7 +138,6 @@ public class IPsTable extends Table {
} }
} finally { } finally {
close(statement); close(statement);
Benchmark.stop("Database", "Save Ips");
} }
} }
@ -238,7 +234,6 @@ public class IPsTable extends Table {
} }
if (commitRequired) { if (commitRequired) {
Log.debug("Database", "Executing ips batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} }
} finally { } finally {

View File

@ -258,7 +258,6 @@ public class KillsTable extends Table {
} }
if (commitRequired) { if (commitRequired) {
Log.debug("Database", "Executing kills batch: " + i);
statement.executeBatch(); statement.executeBatch();
} }
} }

View File

@ -82,7 +82,6 @@ public class NicknamesTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public List<String> getNicknames(int userId) throws SQLException { public List<String> getNicknames(int userId) throws SQLException {
Benchmark.start("Get Nicknames");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -109,7 +108,6 @@ public class NicknamesTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "Get Nicknames");
} }
} }
@ -123,7 +121,6 @@ public class NicknamesTable extends Table {
if (names == null || names.isEmpty()) { if (names == null || names.isEmpty()) {
return; return;
} }
Benchmark.start("Save Nicknames");
names.removeAll(getNicknames(userId)); names.removeAll(getNicknames(userId));
if (names.isEmpty()) { if (names.isEmpty()) {
return; return;
@ -136,23 +133,19 @@ public class NicknamesTable extends Table {
+ columnNick + columnNick
+ ") VALUES (?, ?, ?)"); + ") VALUES (?, ?, ?)");
boolean commitRequired = false; boolean commitRequired = false;
int i = 0;
for (String name : names) { for (String name : names) {
statement.setInt(1, userId); statement.setInt(1, userId);
statement.setInt(2, (name.equals(lastNick)) ? 1 : 0); statement.setInt(2, (name.equals(lastNick)) ? 1 : 0);
statement.setString(3, name); statement.setString(3, name);
statement.addBatch(); statement.addBatch();
commitRequired = true; commitRequired = true;
i++;
} }
if (commitRequired) { if (commitRequired) {
Log.debug("Database", "Executing nicknames batch: " + i);
statement.executeBatch(); statement.executeBatch();
} }
} finally { } finally {
close(statement); close(statement);
Benchmark.stop("Database", "Save Nicknames");
} }
} }

View File

@ -58,7 +58,6 @@ public class SessionsTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public List<SessionData> getSessionData(int userId) throws SQLException { public List<SessionData> getSessionData(int userId) throws SQLException {
Benchmark.start("Get Sessions");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -75,7 +74,6 @@ public class SessionsTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "Get Sessions");
} }
} }
@ -255,8 +253,6 @@ public class SessionsTable extends Table {
statement.setLong(3, session.getSessionEnd()); statement.setLong(3, session.getSessionEnd());
statement.addBatch(); statement.addBatch();
} }
Log.debug("Database", "Executing session batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} finally { } finally {
close(statement); close(statement);

View File

@ -160,8 +160,6 @@ public class TPSTable extends Table {
statement.setDouble(7, tps.getChunksLoaded()); statement.setDouble(7, tps.getChunksLoaded());
statement.addBatch(); statement.addBatch();
} }
Log.debug("Database", "Executing tps batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} finally { } finally {
close(statement); close(statement);

View File

@ -107,7 +107,6 @@ public abstract class Table {
* @throws SQLException * @throws SQLException
*/ */
protected PreparedStatement prepareStatement(String sql) throws SQLException { protected PreparedStatement prepareStatement(String sql) throws SQLException {
Log.debug("Database", sql);
return getConnection().prepareStatement(sql); return getConnection().prepareStatement(sql);
} }

View File

@ -274,7 +274,6 @@ public class UsersTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public UserData getUserData(UUID uuid) throws SQLException { public UserData getUserData(UUID uuid) throws SQLException {
Benchmark.start("Get UserData");
boolean containsBukkitData = getContainsBukkitData(uuid); boolean containsBukkitData = getContainsBukkitData(uuid);
UserData data = null; UserData data = null;
if (containsBukkitData) { if (containsBukkitData) {
@ -284,7 +283,6 @@ public class UsersTable extends Table {
data = new UserData(Fetch.getIOfflinePlayer(uuid)); data = new UserData(Fetch.getIOfflinePlayer(uuid));
addUserInformationToUserData(data); addUserInformationToUserData(data);
} }
Benchmark.stop("Database", "Get UserData");
return data; return data;
} }
@ -312,7 +310,7 @@ public class UsersTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public List<UserData> getUserData(Collection<UUID> uuids) throws SQLException { public List<UserData> getUserData(Collection<UUID> uuids) throws SQLException {
Benchmark.start("Get UserData Multiple"); Benchmark.start("Get UserInfo Multiple");
List<UUID> containsBukkitData = getContainsBukkitData(uuids); List<UUID> containsBukkitData = getContainsBukkitData(uuids);
List<UserData> datas = new ArrayList<>(); List<UserData> datas = new ArrayList<>();
datas.addAll(getUserDataForKnown(containsBukkitData)); datas.addAll(getUserDataForKnown(containsBukkitData));
@ -330,7 +328,7 @@ public class UsersTable extends Table {
datas.addAll(noBukkitData); datas.addAll(noBukkitData);
} }
Benchmark.stop("Database", "Get UserData Multiple"); Benchmark.stop("Database", "Get UserInfo Multiple");
return datas; return datas;
} }
@ -365,7 +363,6 @@ public class UsersTable extends Table {
} }
private UserData getUserDataForKnown(UUID uuid) throws SQLException { private UserData getUserDataForKnown(UUID uuid) throws SQLException {
Benchmark.start("getUserDataForKnown UserData");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -401,13 +398,11 @@ public class UsersTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "getUserDataForKnown UserData");
} }
return null; return null;
} }
private List<UserData> getUserDataForKnown(Collection<UUID> uuids) throws SQLException { private List<UserData> getUserDataForKnown(Collection<UUID> uuids) throws SQLException {
Benchmark.start("getUserDataForKnown Multiple");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
List<UserData> datas = new ArrayList<>(); List<UserData> datas = new ArrayList<>();
@ -448,7 +443,6 @@ public class UsersTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "getUserDataForKnown Multiple");
} }
return datas; return datas;
} }
@ -458,7 +452,6 @@ public class UsersTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public void addUserInformationToUserData(UserData data) throws SQLException { public void addUserInformationToUserData(UserData data) throws SQLException {
Benchmark.start("addUserInformationToUserData");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -488,7 +481,6 @@ public class UsersTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "addUserInformationToUserData");
} }
} }
@ -497,7 +489,6 @@ public class UsersTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public void addUserInformationToUserData(List<UserData> data) throws SQLException { public void addUserInformationToUserData(List<UserData> data) throws SQLException {
Benchmark.start("addUserInformationToUserData Multiple");
PreparedStatement statement = null; PreparedStatement statement = null;
ResultSet set = null; ResultSet set = null;
try { try {
@ -533,7 +524,6 @@ public class UsersTable extends Table {
} finally { } finally {
close(set); close(set);
close(statement); close(statement);
Benchmark.stop("Database", "addUserInformationToUserData Multiple");
} }
} }
@ -542,7 +532,6 @@ public class UsersTable extends Table {
* @throws SQLException * @throws SQLException
*/ */
public void saveUserDataInformation(UserData data) throws SQLException { public void saveUserDataInformation(UserData data) throws SQLException {
Benchmark.start("Save UserInfo");
PreparedStatement statement = null; PreparedStatement statement = null;
try { try {
UUID uuid = data.getUuid(); UUID uuid = data.getUuid();
@ -598,7 +587,6 @@ public class UsersTable extends Table {
} }
} finally { } finally {
close(statement); close(statement);
Benchmark.stop("Database", "Save UserInfo");
} }
} }
@ -738,7 +726,6 @@ public class UsersTable extends Table {
statement.addBatch(); statement.addBatch();
} }
Log.debug("Database", "Executing users batch: " + batchSize);
statement.executeBatch(); statement.executeBatch();
} finally { } finally {
close(statement); close(statement);
@ -801,7 +788,6 @@ public class UsersTable extends Table {
i++; i++;
} }
if (commitRequired) { if (commitRequired) {
Log.debug("Database", "Executing userinfo batch update: " + i);
statement.executeBatch(); statement.executeBatch();
} }
return saveLast; return saveLast;
@ -863,29 +849,6 @@ public class UsersTable extends Table {
} }
} }
/**
* @return @throws SQLException
*/
public Map<Integer, Integer> getLoginTimes() throws SQLException {
Benchmark.start("Get Logintimes");
PreparedStatement statement = null;
ResultSet set = null;
try {
Map<Integer, Integer> ids = new HashMap<>();
statement = prepareStatement("SELECT " + columnID + ", " + columnLoginTimes + " FROM " + tableName);
set = statement.executeQuery();
while (set.next()) {
Integer id = set.getInt(columnID);
ids.put(id, set.getInt(columnLoginTimes));
}
return ids;
} finally {
close(set);
close(statement);
Benchmark.stop("Database", "Get Logintimes");
}
}
/** /**
* @return * @return
*/ */