R
Robert Mark Bram
Hi All,
I have the following code:
private static final Perl5Matcher MATCHER = new Perl5Matcher();
private static boolean validateRegex(
final String field,
final Pattern regex) {
boolean matches = false;
synchronized (MATCHER) {
matches = MATCHER.matches(field, regex);
}
return matches;
}
My question: I do have many threads accessing this code at about the
same time. Is it worthwhile synchronizing on the matches call? I can't
see anything in the docs to say either way, but I am a bit paranoid
since matches isn't a static call..
Rob
I have the following code:
private static final Perl5Matcher MATCHER = new Perl5Matcher();
private static boolean validateRegex(
final String field,
final Pattern regex) {
boolean matches = false;
synchronized (MATCHER) {
matches = MATCHER.matches(field, regex);
}
return matches;
}
My question: I do have many threads accessing this code at about the
same time. Is it worthwhile synchronizing on the matches call? I can't
see anything in the docs to say either way, but I am a bit paranoid
since matches isn't a static call..
Rob