Skip to content

Commit a2d7123

Browse files
committed
LiteTxnProcessorTests clean up (merge main -> ce/main @ 80002)
[git-p4: depot-paths = "//dev/coherence-ce/main/": change = 80003]
1 parent 7a02ecc commit a2d7123

File tree

2 files changed

+33
-21
lines changed

2 files changed

+33
-21
lines changed

prj/coherence-testing-support/src/main/java/common/AbstractTestInfrastructure.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -706,9 +706,11 @@ protected static CoherenceClusterMember startCacheServer(String sServer, String
706706
{
707707
member = startCacheServer(sServer, optionsByType, sProject, fGraceful);
708708
}
709-
catch (IOException e)
709+
catch (Throwable t)
710710
{
711-
throw new RuntimeException("Error starting cache server", e);
711+
// show OS level port usage in case of port binding conflict
712+
displayPortInfo();
713+
throw new RuntimeException("Error starting cache server", t);
712714
}
713715

714716

prj/test/functional/processor/src/test/java/processor/LiteTxnProcessorTests.java

+29-19
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,12 @@ public void testAtomicEntryProcessor()
153153
final int cServers = 4;
154154

155155
MemberHandler memberHandler = new MemberHandler(
156-
CacheFactory.ensureCluster(), getServerPrefix() + "-Atomic",
156+
CacheFactory.ensureCluster(), getServerPrefix() + "-Atomic",
157157
/*fExternalKill*/false, /*fGraceful*/false);
158158

159+
final boolean[] afExiting = new boolean[1];
160+
161+
Thread thdLoad = null;
159162
try
160163
{
161164
// setup, start the initial cache servers
@@ -177,31 +180,28 @@ public void testAtomicEntryProcessor()
177180
}
178181

179182
// start the client (load) thread
180-
final boolean[] afExiting = new boolean[1];
181-
final Object[] aoException = new Object[1];
182-
Thread thdLoad = new Thread()
183+
final Object[] aoException = new Object[1];
184+
185+
thdLoad = new Thread(() ->
183186
{
184-
public void run()
187+
EntryProcessor processor = new AtomicUpdateProcessor();
188+
try
185189
{
186-
EntryProcessor processor = new AtomicUpdateProcessor();
187-
try
190+
while (!afExiting[0])
188191
{
189-
while (!afExiting[0])
192+
for (int i = 0; i < cKeys; i++)
190193
{
191-
for (int i = 0; i < cKeys; i++)
192-
{
193-
cache1.invoke(getKey(i), processor);
194-
}
195-
Base.sleep(10);
194+
cache1.invoke(getKey(i), processor);
196195
}
196+
Base.sleep(10);
197197
}
198-
catch (Exception e)
199-
{
200-
aoException[0] = e;
201-
throw Base.ensureRuntimeException(e);
202-
}
203198
}
204-
};
199+
catch (Exception e)
200+
{
201+
aoException[0] = e;
202+
throw Base.ensureRuntimeException(e);
203+
}
204+
});
205205
thdLoad.start();
206206

207207
// perform the rolling restart
@@ -224,6 +224,16 @@ public void run()
224224
}
225225
finally
226226
{
227+
afExiting[0] = true;
228+
if (thdLoad != null)
229+
{
230+
try
231+
{
232+
thdLoad.join();
233+
}
234+
catch (InterruptedException ignored) {}
235+
}
236+
227237
memberHandler.dispose();
228238
Cluster cluster = CacheFactory.getCluster();
229239
Eventually.assertThat(invoking(cluster).getMemberSet().size(), is(1));

0 commit comments

Comments
 (0)