Interface Serializer
- All Known Implementing Classes:
JDKSerializer, KryoSerializer
public interface Serializer
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidreset()Releases any thread-local resources held by this serializer for the current thread.byte[]Serialize methodunserialize(byte[] bytes) Unserialize method
-
Method Details
-
serialize
-
unserialize
Unserialize method- Parameters:
bytes-- Returns:
- unserialized object
-
reset
default void reset()Releases any thread-local resources held by this serializer for the current thread. Implementations that useThreadLocalstorage (e.g.KryoSerializer) should override this method to callThreadLocal.remove()and prevent ClassLoader pinning / Metaspace leaks in web-container environments (Tomcat, etc.) where container threads are reused across redeployments. Callers (e.g. aServletContextListener) should invoke this method for each thread that has used the serializer before the application is stopped.
-