fix: continuous album now plays again

This commit is contained in:
minjaesong
2024-07-07 02:53:57 +09:00
parent c211f67e38
commit 63070a19d5
10 changed files with 75 additions and 46 deletions

View File

@@ -58,6 +58,7 @@ abstract class TransactionListener {
catch (e: Throwable) {
// if failed, notify the failure
System.err.println("Transaction failure: generic")
e.printStackTrace()
transaction.onFailure(e, state)
}
finally {
@@ -67,7 +68,7 @@ abstract class TransactionListener {
}
else {
System.err.println("Transaction failure: locked")
transaction.onFailure(LockedException(this, currentLock), state)
transaction.onFailure(LockedException(transaction, this, currentLock), state)
}
}.start()
}
@@ -76,8 +77,8 @@ abstract class TransactionListener {
protected abstract fun commitTransaction(state: TransactionState)
}
class LockedException(listener: TransactionListener, lockedBy: Transaction) :
Exception("Transaction is rejected because the class '${listener.javaClass.canonicalName}' is locked by '${lockedBy.javaClass.canonicalName}'")
class LockedException(offendingTransaction: Transaction, listener: TransactionListener, lockedBy: Transaction) :
Exception("Transaction '$offendingTransaction' is rejected because the class '$listener' is locked by '$lockedBy'")
@JvmInline value class TransactionState(val valueTable: HashMap<String, Any?>) {
operator fun get(key: String) = valueTable[key]