public static interface BriteDatabase.Transaction
extends java.io.Closeable
Modifier and Type | Method and Description |
---|---|
void |
close()
Equivalent to calling
end() |
void |
end()
End a transaction.
|
void |
markSuccessful()
Marks the current transaction as successful.
|
boolean |
yieldIfContendedSafely()
Temporarily end the transaction to let other threads run.
|
boolean |
yieldIfContendedSafely(long sleepAmount,
java.util.concurrent.TimeUnit sleepUnit)
Temporarily end the transaction to let other threads run.
|
void end()
BriteDatabase.newTransaction()
for notes about how to use this and when
transactions are committed and rolled back.SQLiteDatabase.endTransaction()
void markSuccessful()
end()
. Do as little non-database work as possible in that
situation too. If any errors are encountered between this and end()
the transaction
will still be committed.SQLiteDatabase.setTransactionSuccessful()
boolean yieldIfContendedSafely()
markSuccessful()
before calling this. When this
returns a new transaction will have been created but not marked as successful. This assumes
that there are no nested transactions (newTransaction has only been called once) and will
throw an exception if that is not the case.SQLiteDatabase.yieldIfContendedSafely()
boolean yieldIfContendedSafely(long sleepAmount, java.util.concurrent.TimeUnit sleepUnit)
markSuccessful()
before calling this. When this
returns a new transaction will have been created but not marked as successful. This assumes
that there are no nested transactions (newTransaction has only been called once) and will
throw an exception if that is not the case.sleepAmount
- if > 0, sleep this long before starting a new transaction if
the lock was actually yielded. This will allow other background threads to make some
more progress than they would if we started the transaction immediately.SQLiteDatabase.yieldIfContendedSafely(long)
void close()
end()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable