adding class resolver with disabled cache, fixing unit tests
This commit is contained in:
parent
7e6d07afaf
commit
cdbaeb86b0
@ -6,6 +6,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ClassResolvers {
|
||||
|
||||
/**
|
||||
* cache disabled
|
||||
* @param classLoader - specific classLoader to use, or null if you want to revert to default
|
||||
* @return new instance of class resolver
|
||||
*/
|
||||
public static ClassResolver cacheDisabled(ClassLoader classLoader) {
|
||||
return new ClassloaderClassResolver(defaultClassLoader(classLoader));
|
||||
}
|
||||
|
||||
/**
|
||||
* non-agressive non-concurrent cache
|
||||
* good for non-shared default cache
|
||||
@ -62,5 +71,4 @@ public class ClassResolvers {
|
||||
|
||||
return ClassResolvers.class.getClassLoader();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class CompactObjectSerializationTest {
|
||||
PipedOutputStream pipeOut = new PipedOutputStream();
|
||||
PipedInputStream pipeIn = new PipedInputStream(pipeOut);
|
||||
CompactObjectOutputStream out = new CompactObjectOutputStream(pipeOut);
|
||||
CompactObjectInputStream in = new CompactObjectInputStream(pipeIn);
|
||||
CompactObjectInputStream in = new CompactObjectInputStream(pipeIn, ClassResolvers.cacheDisabled(null));
|
||||
out.writeObject(List.class);
|
||||
Assert.assertSame(List.class, in.readObject());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user