nit: synchronizing on Strings is particularly dangerous because strings are interned by the VM. Instead just synchronize on the array? The extra contention won't make a measurable difference, and it'll mean fewer locks.