1
1
/*
2
- Copyright (c) 2010, 2018 , Oracle and/or its affiliates. All rights reserved.
2
+ Copyright (c) 2010, 2024 , Oracle and/or its affiliates. All rights reserved.
3
3
4
4
This program is free software; you can redistribute it and/or modify
5
5
it under the terms of the GNU General Public License as published by
17
17
18
18
package testsuite .clusterj ;
19
19
20
+ import java .util .concurrent .atomic .AtomicInteger ;
20
21
import java .util .ArrayList ;
21
22
import java .util .Collection ;
22
23
import java .util .Comparator ;
35
36
import testsuite .clusterj .model .Order ;
36
37
import testsuite .clusterj .model .OrderLine ;
37
38
38
- @ org .junit .Ignore ("Bug#28550140 : disable test until diagnosis of failure" )
39
39
public class ReconnectTest extends AbstractClusterJModelTest {
40
40
41
41
@ Override
@@ -194,10 +194,10 @@ public void test() {
194
194
}
195
195
}
196
196
// summarize for the record
197
- if (retryCount < 5 ) error ("Retry count too low: " + retryCount );
197
+ if (retryCount . get () < 5 ) error ("Retry count too low: " + retryCount . get () );
198
198
if (getDebug ()) {
199
- System .out .println ("Retry count: " + retryCount );
200
- System .out .println ("Number of threads: " + numberOfThreads +
199
+ System .out .println ("Retry count: " + retryCount . get () );
200
+ System .out .println ("Number of threads: " + numberOfThreads +
201
201
"; number of new customers per thread: " + numberOfNewCustomersPerThread +
202
202
"; number of orders per new customer: " + numberOfNewOrdersPerNewCustomer );
203
203
System .out .println ("Created " + nextCustomerId + " customers; " +
@@ -249,12 +249,8 @@ public void test() {
249
249
failOnError ();
250
250
}
251
251
252
- private int retryCount = 0 ;
253
- private void incrementRetryCount () {
254
- synchronized (this ) {
255
- ++retryCount ;
256
- }
257
- }
252
+ private AtomicInteger retryCount = new AtomicInteger ();
253
+
258
254
class Misbehaving implements Runnable {
259
255
@ Override
260
256
public void run () {
@@ -336,7 +332,7 @@ public void run() {
336
332
} catch (ClusterJUserException cjue ) {
337
333
if (getDebug ()) { System .out .println ("StuffToDo: create customer caught " + cjue .getMessage ()); }
338
334
if (cjue .getMessage ().contains ("SessionFactory is not open" )) {
339
- incrementRetryCount ();
335
+ retryCount . getAndIncrement ();
340
336
sleep (300 );
341
337
}
342
338
}
@@ -355,7 +351,7 @@ public void run() {
355
351
} catch (ClusterJUserException cjue ) {
356
352
if (getDebug ()) { System .out .println ("StuffToDo: update orders caught " + cjue .getMessage ()); }
357
353
if (cjue .getMessage ().contains ("SessionFactory is not open" )) {
358
- incrementRetryCount ();
354
+ retryCount . getAndIncrement ();
359
355
sleep (300 );
360
356
}
361
357
}
@@ -372,7 +368,7 @@ public void run() {
372
368
} catch (ClusterJUserException cjue ) {
373
369
if (getDebug ()) { System .out .println ("StuffToDo: delete order caught " + cjue .getMessage ()); }
374
370
if (cjue .getMessage ().contains ("SessionFactory is not open" )) {
375
- incrementRetryCount ();
371
+ retryCount . getAndIncrement ();
376
372
sleep (300 );
377
373
}
378
374
}
0 commit comments