У Вас «check-then-act» проблема когда Вы ивенты проверяете на вхождение
if (_current_events.contains(methodName)) {
...
}
_current_events.add(methodName);
Often problems occur when one thread does a «check-then-act» (e.g. «check» if the value is X, and then «act» to do something that depends on the value being X) and another thread does something to the value in between the «check» and the «act».
Решение может служить замена Collections.synchronizedSet(new HashSet()); на конкурентную мапу (ConcurrentHashMap), в которой храните ивенты как ключи и null как значения
if (!_current_events.contains(methodName)) {
_current_events.add(methodName);
}esle{
throw new RuleViolationException();
}
if (_current_events.contains(methodName)) {
...
}
_current_events.add(methodName);
Often problems occur when one thread does a «check-then-act» (e.g. «check» if the value is X, and then «act» to do something that depends on the value being X) and another thread does something to the value in between the «check» and the «act».
Решение может служить замена Collections.synchronizedSet(new HashSet()); на конкурентную мапу (ConcurrentHashMap), в которой храните ивенты как ключи и null как значения
-XX:MaxNewSize
tinyurl.com/ya39rjm
про синтетический конструктор согласен