This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "cb2d48b5-a05b-4f9b-85d7-50f2d1f35f23", | |
"name": "JWT Auth", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "Register a User", | |
"request": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"info": { | |
"_postman_id": "cb2d48b5-a05b-4f9b-85d7-50f2d1f35f23", | |
"name": "JWT Auth", | |
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" | |
}, | |
"item": [ | |
{ | |
"name": "Register a User", | |
"request": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/main.go b/main.go | |
index 3d28cfa..ad7a3c2 100644 | |
--- a/main.go | |
+++ b/main.go | |
@@ -1,6 +1,7 @@ | |
package main | |
import ( | |
+ "database/sql" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Integer> processExpensiveFunctionElegant(List<Integer> inputs, int firstK) { | |
try { | |
return concurrentWorkExecutor.splitJoin(firstK, | |
inputs, | |
mathService::process, | |
Collectors.toList()); | |
} catch (Exception ex) { | |
log.error("Error processing expensive function", ex); | |
return null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<PaymentMethods> getTopKPaymentMethodDetails(List<Integer> paymentIds, int k) { | |
try { | |
return concurrentWorkExecutor.splitJoin(k, | |
paymentIds, | |
paymentService::fetch, | |
Collectors.toList()); | |
} catch (Exception ex) { | |
log.error("Error processing top K payment methods", ex); | |
return null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.random.aman; | |
import com.google.common.collect.Lists; | |
import lombok.AllArgsConstructor; | |
import lombok.extern.slf4j.Slf4j; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import java.util.concurrent.CompletionService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A concurrent work executor that blocks for the final result after individual execution results | |
* are obtained. The results are fed into the queue represented by completion service as they are | |
* getting completed. Note that this behavior can be changed by using a single threaded executor | |
* <p> | |
* If execution of any individual work results in an exception, an exception is raised | |
*/ | |
static class OutOfOrderConcurrentWorkExecutor implements ConcurrentWorkExecutor { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Integer> processExpensiveFunctionElegant(List<Integer> inputs, int firstK) { | |
try { | |
return concurrentWorkExecutor.splitJoin(firstK, | |
inputs, | |
mathService::process, | |
Collectors.toList()); | |
} catch (Exception ex) { | |
log.error("Error processing expensive function ", ex); | |
return null; |
NewerOlder