From 0a18eeb5f3a08ab249bfb3f17889f847f1eec94b Mon Sep 17 00:00:00 2001 From: jenz Date: Thu, 29 Jun 2023 21:19:50 +0200 Subject: [PATCH] last thing i wanted to make a config setting --- ArtificialAutism/app.config | 1 + .../src/main/java/FunctionLayer/Datahandler.java | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ArtificialAutism/app.config b/ArtificialAutism/app.config index ce49a92b..b930ef19 100644 --- a/ArtificialAutism/app.config +++ b/ArtificialAutism/app.config @@ -10,3 +10,4 @@ app.interval_days=4 app.string_count=14000 app.thread_count=4 app.interval_days_minus=4 +app.random_length=2.5 diff --git a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java index 91025ce4..fbe505b6 100644 --- a/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java +++ b/ArtificialAutism/src/main/java/FunctionLayer/Datahandler.java @@ -587,7 +587,13 @@ public class Datahandler { //System.out.println(ues_copy.toString()); ArrayList> futures = new ArrayList<>(); - + Properties prop = new Properties(); + String fileName = "app.config"; + try (FileInputStream fis = new FileInputStream(fileName)) { + prop.load(fis); + } catch (FileNotFoundException ex) { + } catch (IOException ex) { + } for (String str1 : ues_copy) { if (strF != str1) { //critical section @@ -726,8 +732,6 @@ public class Datahandler { } catch (InterruptedException e) { //throw new RuntimeException(e); pending = 0; - Properties prop = new Properties(); - String fileName = "app.config"; try (FileInputStream fis = new FileInputStream(fileName)) { prop.load(fis); } catch (FileNotFoundException ex) { @@ -740,8 +744,6 @@ public class Datahandler { } catch (ExecutionException e) { //throw new RuntimeException(e); pending = 0; - Properties prop = new Properties(); - String fileName = "app.config"; try (FileInputStream fis = new FileInputStream(fileName)) { prop.load(fis); } catch (FileNotFoundException ex) { @@ -762,9 +764,10 @@ public class Datahandler { //double randomLenghtPermit = strF.length() * (Math.random() * Math.random() * (Math.random() * 10)); Collections.reverse(concurrentRelations); ArrayList mysqlUpdateLastUsed = new ArrayList(); + Double aDouble = Double.valueOf(prop.getProperty("app.random_length")); if (!concurrentRelations.isEmpty()) { for (String secondaryRelation : concurrentRelations) { - if (SB.toString().length() > strF.length() * 3 && !SB.toString().isEmpty()) { + if (SB.toString().length() > strF.length() * aDouble && !SB.toString().isEmpty()) { break; }