The implementations of SerializationProvider can choose (by SPI contract) to return the same instance to multiple requestors as an optimisation, but this is correct to do only if their implementation is threadsafe. It's more common that implementors will opt to return different instances when this might be a simpler strategy to satisfy the threadsafety requirement. For such cases, we need to verify that the various clients using such a Service will not cache it internally in their own fields. This test verifies that an IndexManager won't reuse the instance multiple times; it won't cover all configurable scenarios as there are many: threadsafety can't be guaranteed than by careful design, so the point here is to spot the most obvious mistakes, to draw attention on the problem in case of creative refactoring.
@author Sanne Grinovero (C) 2014 Red Hat Inc.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.