We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi
Please consider the case when several instances of Parser call the parse method, at the same time, each one from a different thread.
public ExpressionNode parse(String expression) { Tokenizer tokenizer = Tokenizer.getExpressionTokenizer(); // <--- tokenizer.tokenize(expression); LinkedList<Token> tokens = tokenizer.getTokens(); return this.parse(tokens); }
public static Tokenizer getExpressionTokenizer() { if (expressionTokenizer == null) expressionTokenizer = createExpressionTokenizer(); return expressionTokenizer; }
As expressionTokenizer is static, every thread would share the tokenizer, which could eventually lead to failure.
This might solve the issue:
public ExpressionNode parse(String expression) { Tokenizer tokenizer = Tokenizer.createExpressionTokenizer(); // <--- tokenizer.tokenize(expression); LinkedList<Token> tokens = tokenizer.getTokens(); return this.parse(tokens); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi
Please consider the case when several instances of Parser call the parse method, at the same time, each one from a different thread.
As expressionTokenizer is static, every thread would share the tokenizer, which could eventually lead to failure.
This might solve the issue:
The text was updated successfully, but these errors were encountered: