@@ -195,60 +195,6 @@ public void assertReturnValues()
195
195
}
196
196
}
197
197
198
- /**
199
- * For testing the asynchronous calls of the RPC client
200
- * implemented with CompletableFuture.
201
- */
202
- static class AsyncCompletableFutureCaller extends Thread {
203
- private final Client client ;
204
- private final InetSocketAddress server ;
205
- private final int count ;
206
- private final List <CompletableFuture <Writable >> completableFutures ;
207
- private final List <Long > expectedValues ;
208
-
209
- AsyncCompletableFutureCaller (Client client , InetSocketAddress server , int count ) {
210
- this .client = client ;
211
- this .server = server ;
212
- this .count = count ;
213
- this .completableFutures = new ArrayList <>(count );
214
- this .expectedValues = new ArrayList <>(count );
215
- setName ("Async CompletableFuture Caller" );
216
- }
217
-
218
- @ Override
219
- public void run () {
220
- // Set the RPC client to use asynchronous mode.
221
- Client .setAsynchronousMode (true );
222
- long startTime = Time .monotonicNow ();
223
- try {
224
- for (int i = 0 ; i < count ; i ++) {
225
- final long param = TestIPC .RANDOM .nextLong ();
226
- TestIPC .call (client , param , server , conf );
227
- expectedValues .add (param );
228
- completableFutures .add (Client .getResponseFuture ());
229
- }
230
- // Since the run method is asynchronous,
231
- // it does not need to wait for a response after sending a request,
232
- // so the time taken by the run method is less than count * 100
233
- // (where 100 is the time taken by the server to process a request).
234
- long cost = Time .monotonicNow () - startTime ;
235
- assertTrue (cost < count * 100L );
236
- LOG .info ("[{}] run cost {}ms" , Thread .currentThread ().getName (), cost );
237
- } catch (Exception e ) {
238
- fail ();
239
- }
240
- }
241
-
242
- public void assertReturnValues ()
243
- throws InterruptedException , ExecutionException {
244
- for (int i = 0 ; i < count ; i ++) {
245
- LongWritable value = (LongWritable ) completableFutures .get (i ).get ();
246
- Assert .assertEquals ("call" + i + " failed." ,
247
- expectedValues .get (i ).longValue (), value .get ());
248
- }
249
- }
250
- }
251
-
252
198
static class AsyncLimitlCaller extends Thread {
253
199
private Client client ;
254
200
private InetSocketAddress server ;
0 commit comments