use of backtype.storm.serialization.KryoTupleDeserializer in project jstorm by alibaba.
the class WorkerData method updateKryoSerializer.
// create kryo serializer
public void updateKryoSerializer() {
WorkerTopologyContext workerTopologyContext = contextMaker.makeWorkerTopologyContext(sysTopology);
KryoTupleDeserializer kryoTupleDeserializer = new KryoTupleDeserializer(stormConf, workerTopologyContext, workerTopologyContext.getRawTopology());
KryoTupleSerializer kryoTupleSerializer = new KryoTupleSerializer(stormConf, workerTopologyContext.getRawTopology());
atomKryoDeserializer.getAndSet(kryoTupleDeserializer);
atomKryoSerializer.getAndSet(kryoTupleSerializer);
}
use of backtype.storm.serialization.KryoTupleDeserializer in project jstorm by alibaba.
the class VirtualPortCtrlDispatch method deserialize.
protected Object deserialize(byte[] ser_msg, int taskId) {
try {
if (ser_msg == null) {
return null;
}
if (ser_msg.length == 0) {
return null;
} else if (ser_msg.length == 1) {
//ignore
return null;
}
Tuple tuple = null;
// ser_msg.length > 1
KryoTupleDeserializer kryo = atomKryoDeserializer.get();
if (kryo != null)
tuple = kryo.deserialize(ser_msg);
return tuple;
} catch (Throwable e) {
if (Utils.exceptionCauseIsInstanceOf(KryoException.class, e))
throw new RuntimeException(e);
LOG.error(idStr + " recv thread error " + JStormUtils.toPrintableString(ser_msg) + "\n", e);
}
return null;
}
Aggregations