Skip to content

Commit

Permalink
adding class resolver with disabled cache, fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alepar committed Nov 22, 2011
1 parent 7e6d07a commit cdbaeb8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@

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
Expand Down Expand Up @@ -62,5 +71,4 @@ static ClassLoader defaultClassLoader(ClassLoader classLoader) {

return ClassResolvers.class.getClassLoader();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void testInterfaceSerialization() throws Exception {
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());
}
Expand Down

0 comments on commit cdbaeb8

Please sign in to comment.