mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-24 01:58:25 +01:00
Transactions can now be executed within other Transactions:
- No save point/connection management overhead.
This commit is contained in:
parent
edb6a6eb72
commit
3ab30f8b9f
@ -83,9 +83,7 @@ public class CleanTransaction extends Transaction {
|
||||
.map(Map.Entry::getKey)
|
||||
.collect(Collectors.toList());
|
||||
for (UUID uuid : inactivePlayers) {
|
||||
// TODO Figure out a better way to schedule transactions from within transactions
|
||||
// or figure out a way to execute the transaction within this transaction.
|
||||
db.executeTransaction(new RemovePlayerTransaction(uuid));
|
||||
executeOther(new RemovePlayerTransaction(uuid));
|
||||
}
|
||||
return inactivePlayers.size();
|
||||
}
|
||||
|
@ -146,6 +146,12 @@ public abstract class Transaction {
|
||||
}
|
||||
}
|
||||
|
||||
protected void executeOther(Transaction transaction) {
|
||||
transaction.connection = this.connection;
|
||||
transaction.performOperations();
|
||||
transaction.connection = null;
|
||||
}
|
||||
|
||||
protected DBType getDBType() {
|
||||
return db.getType();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user