org.apache.storm.utils.Utils.javaDeserialize()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.apache.storm.utils.Utils.javaDeserialize()方法的一些代码示例,展示了Utils.javaDeserialize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.javaDeserialize()方法的具体详情如下:
包路径:org.apache.storm.utils.Utils
类名称:Utils
方法名:javaDeserialize

Utils.javaDeserialize介绍

暂无

代码示例

代码示例来源:origin: apache/storm

private IBatchBolt newTransactionalBolt() {
    return Utils.javaDeserialize(_boltSer, IBatchBolt.class);
  }
}

代码示例来源:origin: apache/storm

@Override
public NimbusInfo getLeader(Runnable callback) {
  if (null != callback) {
    this.leaderInfoCallback.set(callback);
  }
  return Utils.javaDeserialize(this.stateStorage.get_data(ClusterUtils.LEADERINFO_SUBTREE, callback != null), NimbusInfo.class);
}

代码示例来源:origin: apache/storm

public static Object deserializeComponentObject(ComponentObject obj) {
  if (obj.getSetField() != ComponentObject._Fields.SERIALIZED_JAVA) {
    throw new RuntimeException("Cannot deserialize non-java-serialized object");
  }
  return Utils.javaDeserialize(obj.get_serialized_java(), Serializable.class);
}

代码示例来源:origin: apache/storm

private List<IWorkerHook> deserializeWorkerHooks() {
  List<IWorkerHook> myHookList = new ArrayList<>();
  if (topology.is_set_worker_hooks()) {
    for (ByteBuffer hook : topology.get_worker_hooks()) {
      byte[] hookBytes = Utils.toByteArray(hook);
      IWorkerHook hookObject = Utils.javaDeserialize(hookBytes, IWorkerHook.class);
      myHookList.add(hookObject);
    }
  }
  return myHookList;
}

代码示例来源:origin: apache/storm

private static boolean isIdentityPartition(PartitionNode n) {
  Grouping g = n.thriftGrouping;
  if (g.is_set_custom_serialized()) {
    CustomStreamGrouping csg = (CustomStreamGrouping) Utils.javaDeserialize(g.get_custom_serialized(), Serializable.class);
    return csg instanceof IdentityGrouping;
  }
  return false;
}

代码示例来源:origin: apache/storm

public static Object getSetComponentObject(ComponentObject obj) {
  if (obj.getSetField() == ComponentObject._Fields.SERIALIZED_JAVA) {
    return javaDeserialize(obj.get_serialized_java(), Serializable.class);
  } else if (obj.getSetField() == ComponentObject._Fields.JAVA_OBJECT) {
    return obj.get_java_object();
  } else {
    return obj.get_shell();
  }
}

代码示例来源:origin: apache/storm

break;
case CUSTOM_SERIALIZED:
  result = Utils.javaDeserialize(thriftGrouping.get_custom_serialized(), CustomStreamGrouping.class);
  break;
case DIRECT:

代码示例来源:origin: org.apache.storm/storm-core

private IBatchBolt newTransactionalBolt() {
    return Utils.javaDeserialize(_boltSer, IBatchBolt.class);
  }
}

代码示例来源:origin: apache/atlas

private void addTopologyInputs(Map<String, SpoutSpec> spouts, Map stormConf, String topologyOwner, AtlasEntity topology, AtlasEntityExtInfo entityExtInfo) {
  List<AtlasEntity> inputs = new ArrayList<>();
  for (Map.Entry<String, SpoutSpec> entry : spouts.entrySet()) {
    Serializable instance = Utils.javaDeserialize(entry.getValue().get_spout_object().get_serialized_java(), Serializable.class);
    String       dsType   = instance.getClass().getSimpleName();
    AtlasEntity  dsEntity = addDataSet(dsType, topologyOwner, instance, stormConf, entityExtInfo);
    if (dsEntity != null) {
      inputs.add(dsEntity);
    }
  }
  topology.setAttribute("inputs", AtlasTypeUtil.getAtlasObjectIds(inputs));
}

代码示例来源:origin: org.apache.storm/storm-core

private static boolean isIdentityPartition(PartitionNode n) {
  Grouping g = n.thriftGrouping;
  if(g.is_set_custom_serialized()) {
    CustomStreamGrouping csg = (CustomStreamGrouping) Utils.javaDeserialize(g.get_custom_serialized(), Serializable.class);
    return csg instanceof IdentityGrouping;
  }
  return false;
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private void addTopologyInputs(Map<String, SpoutSpec> spouts, Map stormConf, String topologyOwner, AtlasEntity topology, AtlasEntityExtInfo entityExtInfo) {
  List<AtlasEntity> inputs = new ArrayList<>();
  for (Map.Entry<String, SpoutSpec> entry : spouts.entrySet()) {
    Serializable instance = Utils.javaDeserialize(entry.getValue().get_spout_object().get_serialized_java(), Serializable.class);
    String       dsType   = instance.getClass().getSimpleName();
    AtlasEntity  dsEntity = addDataSet(dsType, topologyOwner, instance, stormConf, entityExtInfo);
    if (dsEntity != null) {
      inputs.add(dsEntity);
    }
  }
  topology.setAttribute("inputs", AtlasTypeUtil.getAtlasObjectIds(inputs));
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private void addTopologyOutputs(StormTopology stormTopology, String topologyOwner, Map stormConf, AtlasEntity topology, AtlasEntityExtInfo entityExtInfo) {
  List<AtlasEntity> outputs   = new ArrayList<>();
  Map<String, Bolt> bolts     = stormTopology.get_bolts();
  Set<String>       boltNames = StormTopologyUtil.getTerminalUserBoltNames(stormTopology);
  for (String boltName : boltNames) {
    Serializable instance = Utils.javaDeserialize(bolts.get(boltName).get_bolt_object().get_serialized_java(), Serializable.class);
    String       dsType   = instance.getClass().getSimpleName();
    AtlasEntity  dsEntity = addDataSet(dsType, topologyOwner, instance, stormConf, entityExtInfo);
    if (dsEntity != null) {
      outputs.add(dsEntity);
    }
  }
  topology.setAttribute("outputs", AtlasTypeUtil.getAtlasObjectIds(outputs));
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private AtlasEntity createBoltInstance(String boltName, Bolt stormBolt) {
  AtlasEntity         bolt          = new AtlasEntity(StormDataTypes.STORM_BOLT.getName());
  Serializable        instance      = Utils.javaDeserialize(stormBolt.get_bolt_object().get_serialized_java(), Serializable.class);
  Map<String, String> flatConfigMap = StormTopologyUtil.getFieldValues(instance, true, null);
  bolt.setAttribute(AtlasClient.NAME, boltName);
  bolt.setAttribute("driverClass", instance.getClass().getName());
  bolt.setAttribute("conf", flatConfigMap);
  return bolt;
}

代码示例来源:origin: org.apache.atlas/storm-bridge

private AtlasEntity createSpoutInstance(String spoutName, SpoutSpec stormSpout) {
  AtlasEntity         spout         = new AtlasEntity(StormDataTypes.STORM_SPOUT.getName());
  Serializable        instance      = Utils.javaDeserialize(stormSpout.get_spout_object().get_serialized_java(), Serializable.class);
  Map<String, String> flatConfigMap = StormTopologyUtil.getFieldValues(instance, true, null);
  spout.setAttribute(AtlasClient.NAME, spoutName);
  spout.setAttribute("driverClass", instance.getClass().getName());
  spout.setAttribute("conf", flatConfigMap);
  return spout;
}

代码示例来源:origin: org.apache.storm/storm-core

public static Object getSetComponentObject(ComponentObject obj) {
  if (obj.getSetField() == ComponentObject._Fields.SERIALIZED_JAVA) {
    return Utils.javaDeserialize(obj.get_serialized_java(), Serializable.class);
  } else if (obj.getSetField() == ComponentObject._Fields.JAVA_OBJECT) {
    return obj.get_java_object();
  } else {
    return obj.get_shell();
  }
}

相关文章

Utils类方法