@@ -153,9 +153,12 @@ public void testAtomicEntryProcessor()
153
153
final int cServers = 4 ;
154
154
155
155
MemberHandler memberHandler = new MemberHandler (
156
- CacheFactory .ensureCluster (), getServerPrefix () + "-Atomic" ,
156
+ CacheFactory .ensureCluster (), getServerPrefix () + "-Atomic" ,
157
157
/*fExternalKill*/ false , /*fGraceful*/ false );
158
158
159
+ final boolean [] afExiting = new boolean [1 ];
160
+
161
+ Thread thdLoad = null ;
159
162
try
160
163
{
161
164
// setup, start the initial cache servers
@@ -177,31 +180,28 @@ public void testAtomicEntryProcessor()
177
180
}
178
181
179
182
// 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 (() ->
183
186
{
184
- public void run ()
187
+ EntryProcessor processor = new AtomicUpdateProcessor ();
188
+ try
185
189
{
186
- EntryProcessor processor = new AtomicUpdateProcessor ();
187
- try
190
+ while (!afExiting [0 ])
188
191
{
189
- while (! afExiting [ 0 ] )
192
+ for ( int i = 0 ; i < cKeys ; i ++ )
190
193
{
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 );
196
195
}
196
+ Base .sleep (10 );
197
197
}
198
- catch (Exception e )
199
- {
200
- aoException [0 ] = e ;
201
- throw Base .ensureRuntimeException (e );
202
- }
203
198
}
204
- };
199
+ catch (Exception e )
200
+ {
201
+ aoException [0 ] = e ;
202
+ throw Base .ensureRuntimeException (e );
203
+ }
204
+ });
205
205
thdLoad .start ();
206
206
207
207
// perform the rolling restart
@@ -224,6 +224,16 @@ public void run()
224
224
}
225
225
finally
226
226
{
227
+ afExiting [0 ] = true ;
228
+ if (thdLoad != null )
229
+ {
230
+ try
231
+ {
232
+ thdLoad .join ();
233
+ }
234
+ catch (InterruptedException ignored ) {}
235
+ }
236
+
227
237
memberHandler .dispose ();
228
238
Cluster cluster = CacheFactory .getCluster ();
229
239
Eventually .assertThat (invoking (cluster ).getMemberSet ().size (), is (1 ));
0 commit comments