I really don’t know squat about java memory management, so this is entirely my fault, I just need to be pointed in the direction of a solution.
I’m working with a huge dataset. I have a method that takes a string as input and returns a value. That value is based on the content of the string. If I do this on a slow, granular, one time basis:
while (!input.equals("#")) {
System.out.print("Input input (logical redundancy): ");
Scanner scan = new Scanner(System.in);
input = scan.nextLine();
Analyzer analysis = new Analyzer(new Dictionary());
System.out.println(analysis.analyzeString(input));
}
there are no issues and it is perfectly consistent. A Dictionary object is an array list with key-pair information for certain words.
However, if I attempt to apply that method on a bigger, enumerating scale, then I get bad data returned from the analyze method. In terms of scale, the values are in the right range, however they do not correspond to the strings that they are supposed to. The returned data, to my eye at least, is simply random. I’ve tried various ways of attempting the enumeration, but this is what I have right now:
while (rs.next()) {
int id = rs.getRow();
Analyzer analysis = new Analyzer(dict);
String entry = rs.getString(5);
double val = analysis.analyzeString(entry);
pst.setDouble(1, val);
pst.setInt(2, id);
System.out.println(val + " : " + rs.getString(5));
pst.executeUpdate();
}
In that attempt, there is an extreme inconsistency with the results returned from the analyzeString method, even if the same string is inputted. How can I fix the inconsistency? Does it have to do with synchronization?
To debug your code I suggest you step through you code with you debugger. In an IDE its the button next to run.
I suspect it has nothing to do with it anyway.
Clarify what you mean by inconsistency. That could mean anything. Until you have a good idea of what the problem is, it makes it very hard to fix it.
Its your code. If tyou don’t know nobody does. I suspect not.
BTW: I assume
pstandrshave nothing to do with on another. 😉