Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Register our default serializer via defaults.xml, and throw exception…

… if bad serializer is configured
  • Loading branch information...
commit 9837bc41329c267b823268720af925260bc81750 1 parent 5ea2e6f
afeng authored
1  conf/defaults.yaml
View
@@ -104,6 +104,7 @@ topology.sleep.spout.wait.strategy.time.ms: 1
topology.error.throttle.interval.secs: 10
topology.max.error.report.per.interval: 5
topology.kryo.factory: "backtype.storm.serialization.DefaultKryoFactory"
+topology.tuple.serializer: "backtype.storm.serialization.types.ListDelegateSerializer"
topology.trident.batch.emit.interval.millis: 500
dev.zookeeper.path: "/tmp/dev-storm-zookeeper"
26 src/jvm/backtype/storm/serialization/SerializationFactory.java
View
@@ -34,23 +34,19 @@ public static Kryo getKryo(Map conf) {
Kryo k = kryoFactory.getKryo(conf);
k.register(byte[].class);
- /* tuple payload serializer could be specified via configuration */
+ /* tuple payload serializer is specified via configuration */
String payloadSerializerName = (String)conf.get(Config.TOPOLOGY_TUPLE_SERIALIZER);
- if (payloadSerializerName==null)
- k.register(ListDelegate.class, new ListDelegateSerializer()); //use default payload serializer
- else {
- try {
- Class serializerClass = Class.forName(payloadSerializerName);
- Serializer serializer = resolveSerializerInstance(k, ListDelegate.class, serializerClass, conf);
- if (serializer == null)
- k.register(ListDelegate.class, new ListDelegateSerializer());
- else
- k.register(ListDelegate.class, serializer);
- } catch (ClassNotFoundException ex ){
- LOG.error(ex + " Could not load class in class path: " + payloadSerializerName);
+ try {
+ Class serializerClass = Class.forName(payloadSerializerName);
+ Serializer serializer = resolveSerializerInstance(k, ListDelegate.class, serializerClass, conf);
+ if (serializer == null)
k.register(ListDelegate.class, new ListDelegateSerializer());
- }
- }
+ else
+ k.register(ListDelegate.class, serializer);
+ } catch (ClassNotFoundException ex) {
+ LOG.error("Could not load class in class path: " + payloadSerializerName.length(), ex);
+ throw new RuntimeException(ex);
+ }
k.register(ArrayList.class, new ArrayListSerializer());
k.register(HashMap.class, new HashMapSerializer());
Please sign in to comment.
Something went wrong with that request. Please try again.