本文整理汇总了Java中backtype.storm.utils.Utils.serialize方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.serialize方法的具体用法?Java Utils.serialize怎么用?Java Utils.serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.utils.Utils
的用法示例。
在下文中一共展示了Utils.serialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: commit
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public byte[] commit(BatchId id) throws FailedException {
AtomicLong count = (AtomicLong) counters.remove(id);
if (count == null) {
count = new AtomicLong(0);
}
AtomicLong sum = (AtomicLong) sums.remove(id);
if (sum == null) {
sum = new AtomicLong(0);
}
CommitedValue commitedValue = new CommitedValue(count, sum);
try {
commitedValue.commit();
return Utils.serialize(commitedValue);
} catch (Exception e) {
LOG.error("Failed to commit " + commitedValue, e);
throw new FailedException(e);
}
}
示例2: commit
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public byte[] commit(BatchId id) throws FailedException {
LOG.info("Receive BatchId " + id);
if (currentId == null) {
currentId = id;
}else if (currentId.getId() >= id.getId()) {
LOG.info("Current BatchId is " + currentId + ", receive:"
+ id);
throw new RuntimeException();
}
currentId = id;
AtomicLong counter = (AtomicLong) counters.remove(id);
if (counter == null) {
counter = new AtomicLong(0);
}
LOG.info("Flush " + id + "," + counter);
return Utils.serialize(id);
}
示例3: mkBolt
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs,
IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
示例4: activate_storm
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void activate_storm(String topologyId, StormBase stormBase)
throws Exception {
String stormPath = Cluster.storm_path(topologyId);
byte[] stormBaseData = Utils.serialize(stormBase);
cluster_state.set_data(stormPath, stormBaseData);
}
示例5: store
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
* Stores <code>obj</code> into <code>path</code>.
*
* @param path the path to save to
* @param obj the object to save
* @param transaction use the transaction and add to it, may be <b>null</b> for no transaction
* @param commit commit the transaction, ignored if no transaction
* @throws SignalException in case of I/O problems
*/
private void store(String path, Serializable obj, CuratorTransaction transaction, boolean commit)
throws SignalException {
try {
byte[] data = Utils.serialize(obj);
assertExists(path, transaction, commit);
if (null != transaction) {
checkCommit(transaction.setData().forPath(path, data).and(), commit);
} else {
client.setData().forPath(path, data);
}
} catch (Exception e) {
throw new SignalException(e);
}
}
示例6: set_task
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void set_task(String topologyId, int taskId, TaskInfo info)
throws Exception {
String taskPath = Cluster.task_path(topologyId, taskId);
byte[] taskData = Utils.serialize(info);
cluster_state.set_data(taskPath, taskData);
}
示例7: activate_storm
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void activate_storm(String topologyId, StormBase stormBase) throws Exception {
String stormPath = Cluster.storm_path(topologyId);
byte[] stormBaseData = Utils.serialize(stormBase);
cluster_state.set_data(stormPath, stormBaseData);
}
示例8: set_task
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void set_task(String topologyId, int taskId, TaskInfo info) throws Exception {
String taskPath = Cluster.task_path(topologyId, taskId);
byte[] taskData = Utils.serialize(info);
cluster_state.set_data(taskPath, taskData);
}
示例9: task_heartbeat
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void task_heartbeat(String topologyId, int taskId, TaskHeartbeat info) throws Exception {
String taskPath = Cluster.taskbeat_path(topologyId, taskId);
byte[] taskData = Utils.serialize(info);
cluster_state.set_data(taskPath, taskData);
}
示例10: task_heartbeat
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void task_heartbeat(String topologyId, int taskId, TaskHeartbeat info)
throws Exception {
String taskPath = Cluster.taskbeat_path(topologyId, taskId);
byte[] taskData = Utils.serialize(info);
cluster_state.set_data(taskPath, taskData);
}
示例11: setAssignment
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
/**
* Sets the <code>assignment</code> for the given <code>topology</code> in the zookeeper connection
* <code>framework</code>.
*
* @param framework the Curator framework connection to the Zookeeper
* @param topology the topology to set the assignment for
* @param assignment the assignment to set
* @throws IOException in case of writing problems
*/
public static void setAssignment(CuratorFramework framework, TopologyInfo topology, Assignment assignment)
throws IOException {
try {
byte[] data = Utils.serialize(assignment);
framework.setData().forPath(ASSIGNMENTS_PREFIX + topology.get_id(), data);
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
示例12: BatchBoltExecutor
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public BatchBoltExecutor(IBatchBolt bolt) {
_boltSer = Utils.serialize(bolt);
}
示例13: mkBolt
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static Bolt mkBolt(Map<GlobalStreamId, Grouping> inputs, IBolt bolt, HashMap<String, StreamInfo> output, Integer p) {
ComponentCommon common = mkComponentcommon(inputs, output, p);
byte[] boltSer = Utils.serialize(bolt);
ComponentObject component = ComponentObject.serialized_java(boltSer);
return new Bolt(component, common);
}
示例14: supervisor_heartbeat
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void supervisor_heartbeat(String supervisorId, SupervisorInfo info)
throws Exception {
String supervisorPath = Cluster.supervisor_path(supervisorId);
byte[] infoData = Utils.serialize(info);
cluster_state.set_ephemeral_node(supervisorPath, infoData);
}
示例15: supervisor_heartbeat
import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void supervisor_heartbeat(String supervisorId, SupervisorInfo info) throws Exception {
String supervisorPath = Cluster.supervisor_path(supervisorId);
byte[] infoData = Utils.serialize(info);
cluster_state.set_ephemeral_node(supervisorPath, infoData);
}