Skip to content

Commit 300658a

Browse files
committed
fix TestRBFConfigFields
1 parent b82aee4 commit 300658a

File tree

1 file changed

+0
-54
lines changed
  • hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc

1 file changed

+0
-54
lines changed

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestAsyncIPC.java

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -195,60 +195,6 @@ public void assertReturnValues()
195195
}
196196
}
197197

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-
252198
static class AsyncLimitlCaller extends Thread {
253199
private Client client;
254200
private InetSocketAddress server;

0 commit comments

Comments
 (0)