Prasanna Sairam
11/06/2023, 11:53 AMbattk
11/07/2023, 2:33 AMbattk
11/07/2023, 2:34 AMbattk
11/07/2023, 2:34 AMPrasanna Sairam
11/07/2023, 6:33 AMbattk
11/07/2023, 6:47 AMPrasanna Sairam
11/07/2023, 9:44 AMpublic class MultiThreadTest {
static final WsClient nsClient;
static {
try {
nsClient = getNsClient();
} catch (MalformedURLException e) {
throw new RuntimeException(e);
} catch (RemoteException e) {
throw new RuntimeException(e);
}
}
public static void main(String[] args) throws ExecutionException, InterruptedException, MalformedURLException, RemoteException {
ForkJoinPool customThreadPool = new ForkJoinPool(1);
customThreadPool.submit(
() -> IntStream.range(1, 10).parallel()
.forEach(MultiThreadTest::addCustomer)
).get();
}
static void addCustomer( int i) {
String email = "C_" + i + "@test.com";
long timeTaken;
try {
long start = System.currentTimeMillis();
nsClient.callSearch(getCustomersByEmail(email));
long end = System.currentTimeMillis();
timeTaken = end - start;
} catch (Exception e) {
throw new RuntimeException(e);
}
System.out.println(" search request time taken " + timeTaken);
}
}
battk
11/07/2023, 1:34 PMPrasanna Sairam
11/11/2023, 9:10 AMbattk
11/11/2023, 9:20 AMPrasanna Sairam
11/11/2023, 9:40 AMbattk
11/12/2023, 12:56 PMbattk
11/12/2023, 12:57 PMbattk
11/12/2023, 12:57 PMPrasanna Sairam
11/14/2023, 11:04 AM