Skip to content

Commit

Permalink
Log when falling back to java serialization (#3824)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaheshAravindV authored Jan 2, 2025
1 parent 0b4c21b commit 1ccd04d
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.Serializer;
import com.esotericsoftware.kryo.util.Util;
import java.util.Map;
import org.apache.storm.Config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class DefaultKryoFactory implements IKryoFactory {
private static final Logger LOG = LoggerFactory.getLogger(DefaultKryoFactory.class);

@Override
public Kryo getKryo(Map<String, Object> conf) {
Expand Down Expand Up @@ -51,6 +55,12 @@ public void overrideDefault(boolean value) {
@Override
public Serializer getDefaultSerializer(Class type) {
if (override) {
LOG.warn("Class is not registered: {}\n"
+ "Note: To register this class use: kryo.register({});\n"
+ "Falling back to java serialization.",
Util.className(type), Util.className(type)
);

return new SerializableSerializer();
} else {
return super.getDefaultSerializer(type);
Expand Down

0 comments on commit 1ccd04d

Please sign in to comment.