Skip to content

Commit 25908b4

Browse files
committed
fix and reactivate testConcurrentLockAndQueryDuringTx
1 parent 0b65e85 commit 25908b4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

DaoTest/src/de/greenrobot/daotest/DaoSessionConcurrentTest.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.database.sqlite.SQLiteDatabase;
66
import android.database.sqlite.SQLiteStatement;
77
import android.os.SystemClock;
8+
89
import de.greenrobot.dao.DaoLog;
910
import de.greenrobot.dao.query.DeleteQuery;
1011
import de.greenrobot.dao.query.Query;
@@ -209,17 +210,14 @@ public void run() {
209210
latchThreadsDone.await();
210211
}
211212

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 {
214214
final TestEntity entity = createEntity(null);
215215
dao.insert(entity);
216216
final Query<TestEntity> query = dao.queryBuilder().build();
217217
Runnable runnable1 = new Runnable() {
218218
@Override
219219
public void run() {
220-
synchronized (query) {
221-
query.list();
222-
}
220+
query.forCurrentThread().list();
223221
}
224222
};
225223

@@ -229,9 +227,7 @@ public void run() {
229227
doTx(new Runnable() {
230228
@Override
231229
public void run() {
232-
synchronized (query) {
233-
query.list();
234-
}
230+
query.list();
235231
}
236232
});
237233
latchThreadsDone.await();

0 commit comments

Comments
 (0)