File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
DaoTest/src/de/greenrobot/daotest Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 5
5
import android .database .sqlite .SQLiteDatabase ;
6
6
import android .database .sqlite .SQLiteStatement ;
7
7
import android .os .SystemClock ;
8
+
8
9
import de .greenrobot .dao .DaoLog ;
9
10
import de .greenrobot .dao .query .DeleteQuery ;
10
11
import de .greenrobot .dao .query .Query ;
@@ -209,17 +210,14 @@ public void run() {
209
210
latchThreadsDone .await ();
210
211
}
211
212
212
- // No connection for read can be acquired while TX is active; this will deadlock!
213
- public void _testConcurrentLockAndQueryDuringTx () throws InterruptedException {
213
+ public void testConcurrentLockAndQueryDuringTx () throws InterruptedException {
214
214
final TestEntity entity = createEntity (null );
215
215
dao .insert (entity );
216
216
final Query <TestEntity > query = dao .queryBuilder ().build ();
217
217
Runnable runnable1 = new Runnable () {
218
218
@ Override
219
219
public void run () {
220
- synchronized (query ) {
221
- query .list ();
222
- }
220
+ query .forCurrentThread ().list ();
223
221
}
224
222
};
225
223
@@ -229,9 +227,7 @@ public void run() {
229
227
doTx (new Runnable () {
230
228
@ Override
231
229
public void run () {
232
- synchronized (query ) {
233
- query .list ();
234
- }
230
+ query .list ();
235
231
}
236
232
});
237
233
latchThreadsDone .await ();
You can’t perform that action at this time.
0 commit comments