mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 23:48:42 +01:00
ThrowawayTransactions (on database close)
Some transactions can now be ignored on shutdown to reduce hang time. Affects issues: - Close #1152
This commit is contained in:
parent
e6696abffa
commit
756851fcc2
@ -22,7 +22,7 @@ import com.djrapitops.plan.storage.database.queries.Query;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionIconTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreIconTransaction extends Transaction {
|
||||
public class StoreIconTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final Icon icon;
|
||||
|
||||
|
@ -21,7 +21,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionIconTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -35,7 +35,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.WHERE;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePluginTransaction extends Transaction {
|
||||
public class StorePluginTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final long time;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -37,7 +37,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.WHERE;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreTabInformationTransaction extends Transaction {
|
||||
public class StoreTabInformationTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -40,7 +40,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderT
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreBooleanProviderTransaction extends Transaction {
|
||||
public class StoreBooleanProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String providedCondition;
|
||||
private final boolean hidden;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -44,7 +44,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderT
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreDoubleProviderTransaction extends Transaction {
|
||||
public class StoreDoubleProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID serverUUID;
|
||||
private final ProviderInformation providerInformation;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -40,7 +40,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderT
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreGroupProviderTransaction extends Transaction {
|
||||
public class StoreGroupProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID serverUUID;
|
||||
private ProviderInformation providerInformation;
|
||||
|
@ -24,7 +24,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -42,7 +42,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderT
|
||||
* @author Rsl1122
|
||||
*/
|
||||
@SuppressWarnings("Duplicates")
|
||||
public class StoreNumberProviderTransaction extends Transaction {
|
||||
public class StoreNumberProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final FormatType formatType;
|
||||
private final UUID serverUUID;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -40,7 +40,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderT
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreStringProviderTransaction extends Transaction {
|
||||
public class StoreStringProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final boolean playerName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -25,7 +25,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionPluginTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTabTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -41,7 +41,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionTableProv
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreTableProviderTransaction extends Transaction {
|
||||
public class StoreTableProviderTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID serverUUID;
|
||||
private final ProviderInformation providerInformation;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveInvalidResultsTransaction extends Transaction {
|
||||
public class RemoveInvalidResultsTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -38,7 +38,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveUnsatisfiedConditionalPlayerResultsTransaction extends Transaction {
|
||||
public class RemoveUnsatisfiedConditionalPlayerResultsTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String providerTable;
|
||||
private final String playerValueTable;
|
||||
|
@ -23,7 +23,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionServerValueTable
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionTableProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -42,7 +42,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveUnsatisfiedConditionalServerResultsTransaction extends Transaction {
|
||||
public class RemoveUnsatisfiedConditionalServerResultsTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String providerTable;
|
||||
private final String serverValueTable;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerBooleanResultTransaction extends Transaction {
|
||||
public class StorePlayerBooleanResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerDoubleResultTransaction extends Transaction {
|
||||
public class StorePlayerDoubleResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionGroupsTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerGroupsResultTransaction extends Transaction {
|
||||
public class StorePlayerGroupsResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerNumberResultTransaction extends Transaction {
|
||||
public class StorePlayerNumberResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerPercentageResultTransaction extends Transaction {
|
||||
public class StorePlayerPercentageResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -34,7 +34,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerStringResultTransaction extends Transaction {
|
||||
public class StorePlayerStringResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -25,7 +25,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionTableProviderTab
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecBatchStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
@ -42,7 +42,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionPlayerTab
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StorePlayerTableResultTransaction extends Transaction {
|
||||
public class StorePlayerTableResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerBooleanResultTransaction extends Transaction {
|
||||
public class StoreServerBooleanResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerDoubleResultTransaction extends Transaction {
|
||||
public class StoreServerDoubleResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerNumberResultTransaction extends Transaction {
|
||||
public class StoreServerNumberResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerPercentageResultTransaction extends Transaction {
|
||||
public class StoreServerPercentageResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.extension.implementation.storage.transactions.result
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ExtensionProviderTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -33,7 +33,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerVal
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerStringResultTransaction extends Transaction {
|
||||
public class StoreServerStringResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -25,7 +25,7 @@ import com.djrapitops.plan.storage.database.sql.tables.ExtensionTableProviderTab
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecBatchStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
@ -42,7 +42,7 @@ import static com.djrapitops.plan.storage.database.sql.tables.ExtensionServerTab
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class StoreServerTableResultTransaction extends Transaction {
|
||||
public class StoreServerTableResultTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final String pluginName;
|
||||
private final UUID serverUUID;
|
||||
|
@ -52,7 +52,9 @@ public class DBAccessLock {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
while (database.getState() != Database.State.OPEN) {
|
||||
// Wait for the database to be in OPEN or CLOSING state before allowing execution.
|
||||
// CLOSING is not an allowed state if database was not OPEN at the time of close.
|
||||
while (database.getState() != Database.State.OPEN && database.getState() != Database.State.CLOSING) {
|
||||
synchronized (lockObject) {
|
||||
lockObject.wait();
|
||||
if (database.getState() == Database.State.CLOSED) {
|
||||
|
@ -74,9 +74,18 @@ public interface Database {
|
||||
|
||||
State getState();
|
||||
|
||||
/**
|
||||
* Possible State changes:
|
||||
* CLOSED -> PATCHING (Database init),
|
||||
* PATCHING -> OPEN (Database initialized),
|
||||
* OPEN -> CLOSING (Database closing),
|
||||
* CLOSING -> CLOSED (Database closed),
|
||||
* PATCHING -> CLOSED (Database closed prematurely)
|
||||
*/
|
||||
enum State {
|
||||
CLOSED,
|
||||
PATCHING,
|
||||
OPEN
|
||||
OPEN,
|
||||
CLOSING
|
||||
}
|
||||
}
|
||||
|
@ -213,8 +213,9 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
setState(State.CLOSED);
|
||||
if (getState() == State.OPEN) setState(State.CLOSING);
|
||||
closeTransactionExecutor(transactionExecutor);
|
||||
setState(State.CLOSED);
|
||||
}
|
||||
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
@ -42,7 +42,7 @@ public class BackupCopyTransaction extends RemoveEverythingTransaction {
|
||||
|
||||
@Override
|
||||
protected boolean shouldBeExecuted() {
|
||||
return !sourceDB.equals(destinationDB) && sourceDB.getState() != Database.State.CLOSED;
|
||||
return super.shouldBeExecuted() && !sourceDB.equals(destinationDB) && sourceDB.getState() != Database.State.CLOSED;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* This file is part of Player Analytics (Plan).
|
||||
*
|
||||
* Plan is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License v3 as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Plan 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 Plan. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.djrapitops.plan.storage.database.transactions;
|
||||
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
|
||||
/**
|
||||
* {@link Transaction} that can be thrown away if it is in execution when the database is closing.
|
||||
* <p>
|
||||
* This transaction type is for storing data that is not critical to be saved on plugin shutdown.
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public abstract class ThrowawayTransaction extends Transaction {
|
||||
|
||||
@Override
|
||||
protected boolean shouldBeExecuted() {
|
||||
return getDBState() != Database.State.CLOSING;
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ package com.djrapitops.plan.storage.database.transactions;
|
||||
|
||||
import com.djrapitops.plan.exceptions.database.DBOpException;
|
||||
import com.djrapitops.plan.storage.database.DBType;
|
||||
import com.djrapitops.plan.storage.database.Database;
|
||||
import com.djrapitops.plan.storage.database.SQLDB;
|
||||
import com.djrapitops.plan.storage.database.queries.Query;
|
||||
import com.djrapitops.plugin.utilities.Verify;
|
||||
@ -170,6 +171,10 @@ public abstract class Transaction {
|
||||
transaction.db = null;
|
||||
}
|
||||
|
||||
protected Database.State getDBState() {
|
||||
return db.getState();
|
||||
}
|
||||
|
||||
protected UUID getServerUUID() {
|
||||
return db.getServerUUIDSupplier().get();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.djrapitops.plan.storage.database.transactions.commands;
|
||||
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import static com.djrapitops.plan.storage.database.sql.parsing.Sql.DELETE_FROM;
|
||||
|
||||
@ -26,7 +26,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.DELETE_FROM;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveEverythingTransaction extends Transaction {
|
||||
public class RemoveEverythingTransaction extends ThrowawayTransaction {
|
||||
|
||||
@Override
|
||||
protected void performOperations() {
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.storage.database.transactions.commands;
|
||||
import com.djrapitops.plan.storage.database.queries.PlayerFetchQueries;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -32,7 +32,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemovePlayerTransaction extends Transaction {
|
||||
public class RemovePlayerTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID playerUUID;
|
||||
|
||||
|
@ -19,7 +19,7 @@ package com.djrapitops.plan.storage.database.transactions.commands;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.ServerTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -32,7 +32,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.WHERE;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class SetServerAsUninstalledTransaction extends Transaction {
|
||||
public class SetServerAsUninstalledTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID serverUUID;
|
||||
|
||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.storage.database.transactions.events;
|
||||
|
||||
import com.djrapitops.plan.storage.database.sql.tables.UsersTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -31,7 +31,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.WHERE;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class KickStoreTransaction extends Transaction {
|
||||
public class KickStoreTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID playerUUID;
|
||||
|
||||
|
@ -18,7 +18,7 @@ package com.djrapitops.plan.storage.database.transactions.events;
|
||||
|
||||
import com.djrapitops.plan.delivery.domain.Nickname;
|
||||
import com.djrapitops.plan.storage.database.queries.DataStoreQueries;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.function.BiPredicate;
|
||||
@ -28,7 +28,7 @@ import java.util.function.BiPredicate;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class NicknameStoreTransaction extends Transaction {
|
||||
public class NicknameStoreTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID playerUUID;
|
||||
private final Nickname nickname;
|
||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.storage.database.sql.parsing.Update;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.UserInfoTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -31,7 +31,7 @@ import java.util.UUID;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class OperatorStatusTransaction extends Transaction {
|
||||
public class OperatorStatusTransaction extends ThrowawayTransaction {
|
||||
|
||||
private UUID playerUUID;
|
||||
private boolean operatorStatus;
|
||||
|
@ -17,7 +17,7 @@
|
||||
package com.djrapitops.plan.storage.database.transactions.init;
|
||||
|
||||
import com.djrapitops.plan.storage.database.sql.tables.UserInfoTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
|
||||
@ -29,7 +29,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveDuplicateUserInfoTransaction extends Transaction {
|
||||
public class RemoveDuplicateUserInfoTransaction extends ThrowawayTransaction {
|
||||
|
||||
private static final String COLUMN_ID = UserInfoTable.TABLE_NAME + '.' + UserInfoTable.ID;
|
||||
private static final String STATEMENT_SELECT_DUPLICATE_IDS =
|
||||
|
@ -20,7 +20,7 @@ import com.djrapitops.plan.storage.database.queries.Query;
|
||||
import com.djrapitops.plan.storage.database.queries.QueryStatement;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.*;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
@ -36,7 +36,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveOldExtensionsTransaction extends Transaction {
|
||||
public class RemoveOldExtensionsTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final long deleteOlder;
|
||||
private final UUID serverUUID;
|
||||
|
@ -22,7 +22,7 @@ import com.djrapitops.plan.storage.database.sql.tables.PingTable;
|
||||
import com.djrapitops.plan.storage.database.sql.tables.TPSTable;
|
||||
import com.djrapitops.plan.storage.database.transactions.ExecStatement;
|
||||
import com.djrapitops.plan.storage.database.transactions.Executable;
|
||||
import com.djrapitops.plan.storage.database.transactions.Transaction;
|
||||
import com.djrapitops.plan.storage.database.transactions.ThrowawayTransaction;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@ -36,7 +36,7 @@ import static com.djrapitops.plan.storage.database.sql.parsing.Sql.*;
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class RemoveOldSampledDataTransaction extends Transaction {
|
||||
public class RemoveOldSampledDataTransaction extends ThrowawayTransaction {
|
||||
|
||||
private final UUID serverUUID;
|
||||
private final long deleteTPSOlderThanMs;
|
||||
|
Loading…
Reference in New Issue
Block a user