当前位置: 首页>>代码示例>>Java>>正文


Java Utils.serialize方法代码示例

本文整理汇总了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);
	}

}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:26,代码来源:DBBolt.java

示例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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:21,代码来源:SimpleBolt.java

示例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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:8,代码来源:Thrift.java

示例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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:10,代码来源:StormZkClusterState.java

示例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);
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:24,代码来源:PortManager.java

示例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);
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:10,代码来源:StormZkClusterState.java

示例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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:9,代码来源:StormZkClusterState.java

示例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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:9,代码来源:StormZkClusterState.java

示例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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:9,代码来源:StormZkClusterState.java

示例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);
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:10,代码来源:StormZkClusterState.java

示例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());
    }
}
 
开发者ID:QualiMaster,项目名称:Infrastructure,代码行数:19,代码来源:ZkUtils.java

示例12: BatchBoltExecutor

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public BatchBoltExecutor(IBatchBolt bolt) {
	_boltSer = Utils.serialize(bolt);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:4,代码来源:BatchBoltExecutor.java

示例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);
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:7,代码来源:Thrift.java

示例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);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:11,代码来源:StormZkClusterState.java

示例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);
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:10,代码来源:StormZkClusterState.java


注:本文中的backtype.storm.utils.Utils.serialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。