adding an minor iteration comparission cap
This commit is contained in:
parent
d62cdf3aeb
commit
ee1603dc50
@ -222,7 +222,7 @@ public class Datahandler {
|
|||||||
hlStatsMessages.put(str, hlStatsMessages.size());
|
hlStatsMessages.put(str, hlStatsMessages.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int capacity = 1500;
|
int capacity = 5500;
|
||||||
hlStatsMessages.keySet().forEach(str -> {
|
hlStatsMessages.keySet().forEach(str -> {
|
||||||
if (!str.startsWith("!") && MessageResponseHandler.getStr().values().size() < capacity) {
|
if (!str.startsWith("!") && MessageResponseHandler.getStr().values().size() < capacity) {
|
||||||
String orElse = strCacheLocal.values().parallelStream().filter(e -> e.equals(str)).findAny().orElse(null);
|
String orElse = strCacheLocal.values().parallelStream().filter(e -> e.equals(str)).findAny().orElse(null);
|
||||||
@ -319,7 +319,20 @@ public class Datahandler {
|
|||||||
SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(str, null);
|
SentimentValueCache sentimentCacheStr = sentimentCachingMap.getOrDefault(str, null);
|
||||||
List<SimilarityMatrix> smxReturnList = new ArrayList();
|
List<SimilarityMatrix> smxReturnList = new ArrayList();
|
||||||
ExecutorService smxService = Executors.newFixedThreadPool(6);
|
ExecutorService smxService = Executors.newFixedThreadPool(6);
|
||||||
|
List<String> randomIterationComparision = new ArrayList();
|
||||||
|
int iteratecap = strCacheLocal.size() > 150 ? strCacheLocal.size() - 150 : strCacheLocal.size();
|
||||||
|
int iterator = ThreadLocalRandom.current().nextInt(0, iteratecap);
|
||||||
|
int iterated = 0;
|
||||||
for (String str1 : strCacheLocal.values()) {
|
for (String str1 : strCacheLocal.values()) {
|
||||||
|
if (iterated >= iterator && iterated < iterator + 150) {
|
||||||
|
randomIterationComparision.add(str1);
|
||||||
|
}
|
||||||
|
if (iterated > iterator + 150) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
iterated++;
|
||||||
|
}
|
||||||
|
for (String str1 : randomIterationComparision) {
|
||||||
if (!str.equals(str1)) {
|
if (!str.equals(str1)) {
|
||||||
SimilarityMatrix SMXInit = new SimilarityMatrix(str, str1);
|
SimilarityMatrix SMXInit = new SimilarityMatrix(str, str1);
|
||||||
SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null);
|
SentimentValueCache sentimentCacheStr1 = sentimentCachingMap.getOrDefault(str1, null);
|
||||||
@ -340,6 +353,7 @@ public class Datahandler {
|
|||||||
SimilarityMatrix SMX = future.get();
|
SimilarityMatrix SMX = future.get();
|
||||||
if (SMX != null) {
|
if (SMX != null) {
|
||||||
smxReturnList.add(SMX);
|
smxReturnList.add(SMX);
|
||||||
|
//System.out.println("added SMX: " + SMX.getPrimaryString() + "\n" + SMX.getSecondaryString() + "\n\n");
|
||||||
}
|
}
|
||||||
} catch (InterruptedException | ExecutionException ex) {
|
} catch (InterruptedException | ExecutionException ex) {
|
||||||
//System.out.println("failed future get");
|
//System.out.println("failed future get");
|
||||||
@ -783,7 +797,7 @@ public class Datahandler {
|
|||||||
// System.out.println("iterator: " + annCollector.i + "\nstr size: " + str.size() + "\n");
|
// System.out.println("iterator: " + annCollector.i + "\nstr size: " + str.size() + "\n");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(4000);
|
Thread.sleep(10000);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Datahandler.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user