Open eatkins opened 5 years ago
Matcher says:
Instances of this class are not safe for use by multiple concurrent threads.
final class PatternFilter(val pattern: Pattern) extends NameFilter {
def accept(name: String): Boolean = pattern.matcher(name).matches
...
}
so from a single pattern potentially multiple PatternFilter can be created, and accept
can be called multiple times.
Aah, good find. Looks like maybe I should add a lock to PatternFilter. The PrefixFilter that I added is a nice optimization (https://github.com/eatkins/io/commit/9ac0e3e5810a1fb905ece249b74c5667160cfac2) that should fix the test but does not preclude the lock.
I should probably add suffix filter as well since it's a trivial addition.
I've noticed that both in CI and on my computer that sometimes io/test hangs. I was able to get a stack trace with jstack: