本文整理了Java中backtype.storm.utils.Utils.javaDeserialize()
方法的一些代码示例,展示了Utils.javaDeserialize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.javaDeserialize()
方法的具体详情如下:
包路径:backtype.storm.utils.Utils
类名称:Utils
方法名:javaDeserialize
[英]Deserialized with ClassLoader
[中]用类加载器反序列化
代码示例来源:origin: alibaba/jstorm
/**
* Go thrift gzip serializer
*/
public static <T> T deserialize(byte[] serialized, Class<T> clazz) {
/**
* @@@ JStorm disable the thrift.gz.serializer
*/
// return serializationDelegate.deserialize(serialized, clazz);
return (T) javaDeserialize(serialized);
}
代码示例来源:origin: alibaba/jstorm
@Override
public T deserialize(byte[] b) {
if (b != null)
return (T) Utils.javaDeserialize(b);
else
return null;
}
}
代码示例来源:origin: alibaba/jstorm
private IBatchBolt newTransactionalBolt() {
return Utils.javaDeserialize(_boltSer, IBatchBolt.class);
}
}
代码示例来源:origin: alibaba/jstorm
protected Object deserialize(byte[] data) {
return Utils.javaDeserialize(data);
}
}
代码示例来源:origin: alibaba/jstorm
@Override
public void revert(BatchId id, byte[] commitResult) {
LOG.info("Receive BatchId " + id);
BatchId failedId = (BatchId) Utils.javaDeserialize(commitResult);
if (!failedId.equals(id)) {
LOG.info("Deserialized error " + id);
}
}
}
代码示例来源:origin: alibaba/jstorm
@SuppressWarnings("unchecked")
public static Object readLocalObject(String topologyId, String readFile) throws IOException {
String errMsg = "Failed to get topology configuration of " + topologyId + " file:" + readFile;
byte[] bconf = FileUtils.readFileToByteArray(new File(readFile));
if (bconf == null) {
errMsg += ", failed to read";
LOG.error(errMsg);
throw new IOException(errMsg);
}
Object ret;
try {
ret = Utils.javaDeserialize(bconf);
} catch (Exception e) {
errMsg += ", failed to serialize the data";
LOG.error(errMsg);
throw new IOException(errMsg);
}
return ret;
}
代码示例来源:origin: alibaba/jstorm
@Override
public Object get(String key) {
for (Entry<Integer, ColumnFamilyHandle> entry : windowHandlers.entrySet()) {
try {
byte[] data = ttlDB.get(entry.getValue(), key.getBytes());
if (data != null) {
try {
return Utils.javaDeserialize(data);
} catch (Exception e) {
LOG.error("Failed to deserialize obj of " + key);
ttlDB.remove(entry.getValue(), key.getBytes());
return null;
}
}
} catch (Exception ignored) {
}
}
return null;
}
代码示例来源:origin: alibaba/jstorm
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: alibaba/jstorm
public static Map read_nimbus_topology_conf(String topologyId, BlobStore blobStore)
throws IOException, KeyNotFoundException {
return Utils.javaDeserialize(blobStore.readBlob(master_stormconf_key(topologyId)), Map.class);
}
代码示例来源:origin: alibaba/jstorm
public static StormTopology read_nimbus_topology_code(String topologyId, BlobStore blobStore)
throws IOException, KeyNotFoundException {
return Utils.javaDeserialize(blobStore.readBlob(master_stormcode_key(topologyId)), StormTopology.class);
}
代码示例来源:origin: alibaba/jstorm
value = Utils.javaDeserialize(valueByte);
} catch (Exception e) {
LOG.error("Failed to deserialize obj of " + new String(keyByte));
代码示例来源:origin: alibaba/jstorm
private Map<Object, Object> deserializeLatestVersion() throws IOException {
String latestPath = _vs.mostRecentVersionPath();
Long latestVersion = _vs.mostRecentVersion();
Map<Object, Object> result = new HashMap<>();
while (latestPath != null) {
byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath));
if (serialized.length == 0) {
LOG.warn("LocalState file '{}' contained no data, skip this state", latestPath);
latestPath = _vs.mostRecentVersionPath(latestVersion - 1);
latestVersion = _vs.mostRecentVersion(latestVersion - 1);
} else {
result = (Map<Object, Object>) Utils.javaDeserialize(serialized);
break;
}
}
return result;
}
代码示例来源:origin: alibaba/jstorm
CustomStreamGrouping g = (CustomStreamGrouping) Utils.javaDeserialize(obj);
int myTaskId = topologyContext.getThisTaskId();
String componentId = topologyContext.getComponentId(myTaskId);
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
/**
* Go thrift gzip serializer
*/
public static <T> T deserialize(byte[] serialized, Class<T> clazz) {
/**
* @@@ JStorm disable the thrift.gz.serializer
*/
// return serializationDelegate.deserialize(serialized, clazz);
return (T) javaDeserialize(serialized);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
private IBatchBolt newTransactionalBolt() {
return Utils.javaDeserialize(_boltSer, IBatchBolt.class);
}
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
protected Object deserialize(byte[] data) {
return Utils.javaDeserialize(data);
}
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-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: com.alibaba.jstorm/jstorm-core
public static Map read_nimbus_topology_conf(String topologyId, BlobStore blobStore) throws IOException, KeyNotFoundException {
return Utils.javaDeserialize(blobStore.readBlob(master_stormconf_key(topologyId)), Map.class);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
public static StormTopology read_nimbus_topology_code(String topologyId, BlobStore blobStore) throws IOException, KeyNotFoundException {
return Utils.javaDeserialize(blobStore.readBlob(master_stormcode_key(topologyId)), StormTopology.class);
}
代码示例来源:origin: com.alibaba.jstorm/jstorm-core
private Map<Object, Object> deserializeLatestVersion() throws IOException {
String latestPath = _vs.mostRecentVersionPath();
Long latestVersion = _vs.mostRecentVersion();
Map<Object, Object> result = new HashMap<Object, Object>();
while (latestPath != null) {
byte[] serialized = FileUtils.readFileToByteArray(new File(latestPath));
if (serialized.length == 0) {
LOG.warn("LocalState file '{}' contained no data, skip this state", latestPath);
latestPath = _vs.mostRecentVersionPath(latestVersion - 1);
latestVersion = _vs.mostRecentVersion(latestVersion - 1);
} else {
result = (Map<Object, Object>) Utils.javaDeserialize(serialized);
break;
}
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!