20
20
import java .util .concurrent .atomic .AtomicInteger ;
21
21
import java .util .concurrent .atomic .AtomicReference ;
22
22
23
+ import org .eclipse .rdf4j .common .concurrent .locks .Properties ;
23
24
import org .eclipse .rdf4j .common .iteration .CloseableIteration ;
24
25
import org .eclipse .rdf4j .common .transaction .IsolationLevels ;
25
26
import org .eclipse .rdf4j .model .IRI ;
36
37
import org .junit .jupiter .api .Assertions ;
37
38
import org .junit .jupiter .api .BeforeEach ;
38
39
import org .junit .jupiter .api .Disabled ;
39
- import org .junit .jupiter .api .Test ;
40
+ import org .junit .jupiter .api .RepeatedTest ;
40
41
import org .slf4j .Logger ;
41
42
import org .slf4j .LoggerFactory ;
42
43
@@ -76,6 +77,7 @@ public abstract class SailConcurrencyTest {
76
77
77
78
@ BeforeEach
78
79
public void setUp () {
80
+ Properties .setLockTrackingEnabled (true );
79
81
store = createSail ();
80
82
store .init ();
81
83
vf = store .getValueFactory ();
@@ -154,7 +156,8 @@ public int getSize() {
154
156
*
155
157
* @see <a href="https://github.com/eclipse/rdf4j/issues/693">https://github.com/eclipse/rdf4j/issues/693</a>
156
158
*/
157
- @ Test
159
+ // @Test
160
+ @ RepeatedTest (100 )
158
161
public void testConcurrentAddLargeTxn () throws Exception {
159
162
logger .info ("executing two large concurrent transactions" );
160
163
final CountDownLatch runnersDone = new CountDownLatch (2 );
@@ -195,7 +198,7 @@ public void testConcurrentAddLargeTxn() throws Exception {
195
198
* Verifies that two large concurrent transactions in separate contexts do not cause inconsistencies or errors when
196
199
* one of the transactions rolls back at the end.
197
200
*/
198
- @ Test
201
+ @ RepeatedTest ( 100 )
199
202
public void testConcurrentAddLargeTxnRollback () throws Exception {
200
203
logger .info ("executing two large concurrent transactions" );
201
204
final CountDownLatch runnersDone = new CountDownLatch (2 );
@@ -236,7 +239,7 @@ public void testConcurrentAddLargeTxnRollback() throws Exception {
236
239
237
240
}
238
241
239
- @ Test
242
+ @ RepeatedTest ( 100 )
240
243
@ Disabled ("This test takes a long time and accomplishes little extra" )
241
244
public void testGetContextIDs () throws Exception {
242
245
// Create one thread which writes statements to the repository, on a
@@ -313,7 +316,7 @@ public void testGetContextIDs() throws Exception {
313
316
}
314
317
}
315
318
316
- @ Test
319
+ @ RepeatedTest ( 100 )
317
320
public void testConcurrentConnectionsShutdown () throws InterruptedException {
318
321
if (store instanceof AbstractSail ) {
319
322
((AbstractSail ) store ).setConnectionTimeOut (200 );
@@ -356,8 +359,8 @@ public void testConcurrentConnectionsShutdown() throws InterruptedException {
356
359
357
360
}
358
361
359
- // @Disabled
360
- @ Test
362
+ // @Disabled
363
+ @ RepeatedTest ( 100 )
361
364
public void testSerialThreads () throws InterruptedException {
362
365
if (store instanceof AbstractSail ) {
363
366
((AbstractSail ) store ).setConnectionTimeOut (200 );
@@ -437,7 +440,7 @@ public void testSerialThreads() throws InterruptedException {
437
440
438
441
}
439
442
440
- @ Test
443
+ @ RepeatedTest ( 100 )
441
444
public void testConcurrentConnectionsShutdownReadCommitted () throws InterruptedException {
442
445
if (store instanceof AbstractSail ) {
443
446
((AbstractSail ) store ).setConnectionTimeOut (200 );
@@ -492,7 +495,7 @@ public void testConcurrentConnectionsShutdownReadCommitted() throws InterruptedE
492
495
493
496
}
494
497
495
- @ Test
498
+ @ RepeatedTest ( 100 )
496
499
public void testConcurrentConnectionsShutdownAndClose () throws InterruptedException {
497
500
if (store instanceof AbstractSail ) {
498
501
((AbstractSail ) store ).setConnectionTimeOut (200 );
@@ -537,13 +540,24 @@ public void testConcurrentConnectionsShutdownAndClose() throws InterruptedExcept
537
540
538
541
try {
539
542
if (thread2 .isAlive ()) {
543
+ // try {
540
544
connection2 .get ().close ();
545
+
546
+ // }finally {
541
547
connection1 .get ().close ();
548
+
549
+ // }
542
550
} else {
551
+ // try {
543
552
connection1 .get ().close ();
553
+
554
+ // }finally {
544
555
connection2 .get ().close ();
556
+
557
+ // }
545
558
}
546
- } catch (SailException ignored ) {
559
+ } catch (Throwable logged ) {
560
+ logger .error ("Error closing connection" , logged );
547
561
}
548
562
549
563
try (SailConnection connection = store .getConnection ()) {
@@ -567,7 +581,7 @@ public void testConcurrentConnectionsShutdownAndClose() throws InterruptedExcept
567
581
store .shutDown ();
568
582
}
569
583
570
- @ Test
584
+ @ RepeatedTest ( 100 )
571
585
public void testConcurrentConnectionsShutdownAndCloseRollback () throws InterruptedException {
572
586
if (store instanceof AbstractSail ) {
573
587
((AbstractSail ) store ).setConnectionTimeOut (200 );
0 commit comments