When multiple threads are generating the same DynamicScope class, both
threads may try to generate the same class at the same time. When the second
thread hits defineClass, it throws a LinkageError becuase the class has already
With this change we catch this exception and call loadClass to get the class that
the previous thread created.
All checks have failed
1 errored and 1 failing checks
— The Travis CI build could not complete due to an error
This is an enhancement to #4285 to avoid the exception altogether.
Any remaining exceptions that bubble out are intended to do so, so
we can see them and get reports and fix them. This modification
should effectively prevent double-loading (which caused the
LinkageError) but have reduced overhead.