backtype.storm.utils.Utils.deserialize()方法的使用及代码示例

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

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

Utils.deserialize介绍

[英]Go thrift gzip serializer
[中]Go thrift gzip序列化程序

代码示例

代码示例来源:origin: alibaba/mdrill

private IBatchBolt newTransactionalBolt() {
    return (IBatchBolt) Utils.deserialize(_boltSer);
  }
}

代码示例来源:origin: alibaba/mdrill

public static Object maybe_deserialize(byte[] data) {
  if (data == null) {
    return null;
  }
  return Utils.deserialize(data);
}

代码示例来源:origin: alibaba/jstorm

public static String getData(DistributedClusterState zkClusterState,
               String path) throws Exception {
  byte[] data = zkClusterState.get_data(path, false);
  if (data == null || data.length == 0) {
    return null;
  }
  Object obj = Utils.deserialize(data, null);
  return obj.toString();
}

代码示例来源:origin: alibaba/mdrill

public synchronized Map<Object, Object> snapshot() throws IOException {
  String latestPath = _vs.mostRecentVersionPath();
  if(latestPath==null) return new HashMap<Object, Object>();
  return (Map<Object, Object>) Utils.deserialize(FileUtils.readFileToByteArray(new File(latestPath)));
}

代码示例来源:origin: alibaba/mdrill

public static Map read_supervisor_storm_conf(Map conf, String storm_id)
    throws IOException {
  String stormroot = StormConfig
      .supervisor_stormdist_root(conf, storm_id);
  String conf_path = StormConfig.supervisor_sotrmconf_path(stormroot);
  // String topology_path =
  // StormConfig.supervisor_stormcode_path(stormroot);
  Map rtn = new HashMap();
  rtn.putAll(conf);
  rtn.putAll((Map) Utils.deserialize(FileUtils
      .readFileToByteArray(new File(conf_path))));
  return rtn;
}

代码示例来源:origin: alibaba/mdrill

public static StormTopology read_supervisor_topology(Map conf,
    String topologyid) throws IOException {
  String topologyroot = StormConfig.supervisor_stormdist_root(conf,
      topologyid);
  String topology_path = StormConfig
      .supervisor_stormcode_path(topologyroot);
  return (StormTopology) Utils.deserialize(FileUtils
      .readFileToByteArray(new File(topology_path)));
}

代码示例来源:origin: alibaba/mdrill

/**
 * ӱлļȡStormTopologyϢ
 * 
 * @param conf
 * @param topologyId
 * @return
 * @throws IOException
 */
public StormTopology readStormTopology(Map<Object, Object> conf,
    String topologyId) throws IOException {
  String stormroot = StormConfig.masterStormdistRoot(conf, topologyId);
  StormTopology topology = null;
  byte[] bTopo = FileUtils.readFileToByteArray(new File(StormConfig
      .masterStormcodePath(stormroot)));
  if (bTopo != null) {
    topology = (StormTopology) Utils.deserialize(bTopo);
  }
  return topology;
}

代码示例来源:origin: alibaba/mdrill

/**
 * stormconf is mergered into clusterconf
 * 
 * @param conf
 * @param stormId
 * @return Map
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
public static Map readStormConf(Map conf, String stormId) {
  String stormroot = StormConfig.masterStormdistRoot(conf, stormId);
  Map stormconf = null;
  try {
    stormconf = (Map) Utils.deserialize(FileUtils
        .readFileToByteArray(new File(StormConfig
            .masterStormconfPath(stormroot))));
  } catch (IOException e) {
    LOG.error(e + "readStormConf exception");
  }
  Map rtn = new HashMap();
  rtn.putAll(conf);
  rtn.putAll(stormconf);
  return rtn;
}

代码示例来源:origin: alibaba/mdrill

/**
 * stormconf is mergered into clusterconf
 * 
 * @param conf
 * @param stormId
 * @return Map
 */
@SuppressWarnings("unchecked")
public Map<Object, Object> readStormConf(Map<Object, Object> conf,
    String stormId) {
  String stormroot = StormConfig.masterStormdistRoot(conf, stormId);
  Map<Object, Object> stormconf = new HashMap<Object, Object>();
  try {
    byte[] bconf = FileUtils.readFileToByteArray(new File(StormConfig
        .masterStormconfPath(stormroot)));
    if (bconf != null) {
      stormconf = (Map<Object, Object>) Utils.deserialize(bconf);
    }
  } catch (IOException e) {
    LOG.error(e + "readStormConf exception");
  }
  Map<Object, Object> rtn = new HashMap<Object, Object>();
  rtn.putAll(conf);
  rtn.putAll(stormconf);
  return rtn;
}

代码示例来源:origin: alibaba/mdrill

/**
 * ȡ Task Object
 * @param obj
 * @return
 */
private static Object getSetComponentObject(ComponentObject obj) {
  if (obj.getSetField() == ComponentObject._Fields.SERIALIZED_JAVA) {
    return Utils.deserialize(obj.get_serialized_java());
  } else if (obj.getSetField() == ComponentObject._Fields.JAVA_OBJECT) {
    return obj.get_java_object();
  } else {
    return obj.get_shell();
  }
}

代码示例来源:origin: alibaba/mdrill

.deserialize(obj);
custom_grouper = new MkCustomGrouper(g, out_fields, num_tasks);
grouperType = GrouperType.custom_serialized;

代码示例来源:origin: com.n3twork.storm/storm-core

private IBatchBolt newTransactionalBolt() {
    return (IBatchBolt) Utils.deserialize(_boltSer);
  }
}

代码示例来源:origin: com.alibaba.jstorm/jstorm-core

public static String getData(DistributedClusterState zkClusterState,
               String path) throws Exception {
  byte[] data = zkClusterState.get_data(path, false);
  if (data == null || data.length == 0) {
    return null;
  }
  Object obj = Utils.deserialize(data, null);
  return obj.toString();
}

代码示例来源:origin: com.n3twork.storm/storm-core

public synchronized Map<Object, Object> snapshot() throws IOException {
  int attempts = 0;
  while(true) {
    String latestPath = _vs.mostRecentVersionPath();
    if(latestPath==null) return new HashMap<Object, Object>();
    try {
      return (Map<Object, Object>) Utils.deserialize(FileUtils.readFileToByteArray(new File(latestPath)));
    } catch(IOException e) {
      attempts++;
      if(attempts >= 10) {
        throw e;
      }
    }
  }
}

代码示例来源:origin: com.n3twork.storm/storm-core

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

代码示例来源:origin: com.n3twork.storm/storm-core

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

相关文章