Looking through the UriMatcher source , it seems that several threads can call the match method at the same time, since the match implementation only accesses the uri stream variable (parameter), common String s and ArrayList<UriMatcher> elements (via ArrayList#get(int) , which is thread safe )
addURI not thread safe because it structurally modifies the ArrayList . This is the same ArrayList that match is read, so addURI cannot be called, and other threads may call match .
source share