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


Java Utils.get方法代码示例

本文整理汇总了Java中backtype.storm.utils.Utils.get方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.get方法的具体用法?Java Utils.get怎么用?Java Utils.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backtype.storm.utils.Utils的用法示例。


在下文中一共展示了Utils.get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: emitPartitionBatch

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public MemoryTransactionalSpoutMeta emitPartitionBatch(
		TransactionAttempt tx, BatchOutputCollector collector,
		int partition, MemoryTransactionalSpoutMeta lastPartitionMeta) {
	if (!Boolean.FALSE.equals(getDisabledStatuses().get(partition))) {
		int index;
		if (lastPartitionMeta == null) {
			index = 0;
		} else {
			index = lastPartitionMeta.index + lastPartitionMeta.amt;
		}
		List<List<Object>> queue = getQueues().get(partition);
		int total = queue.size();
		int left = total - index;
		int toTake = Math.min(left, _takeAmt);

		MemoryTransactionalSpoutMeta ret = new MemoryTransactionalSpoutMeta(
				index, toTake);
		for (int i = ret.index; i < ret.index + ret.amt; i++) {
			List<Object> toEmit = new ArrayList<Object>(queue.get(i));
			toEmit.add(0, tx);
			collector.emit(toEmit);
		}
		if (toTake == 0) {
			// this is a pretty hacky way to determine when all the
			// partitions have been committed
			// wait until we've emitted max-spout-pending empty
			// partitions for the partition
			int curr = Utils.get(_emptyPartitions, partition, 0) + 1;
			_emptyPartitions.put(partition, curr);
			if (curr > _maxSpoutPending) {
				getFinishedStatuses().put(partition, true);
			}
		}
		return ret;
	} else {
		return null;
	}
}
 
开发者ID:greeenSY,项目名称:Tstream,代码行数:40,代码来源:OpaqueMemoryTransactionalSpout.java

示例2: emitPartitionBatchNew

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public MemoryTransactionalSpoutMeta emitPartitionBatchNew(
		TransactionAttempt tx, BatchOutputCollector collector,
		int partition, MemoryTransactionalSpoutMeta lastPartitionMeta) {
	int index;
	if (lastPartitionMeta == null) {
		index = 0;
	} else {
		index = lastPartitionMeta.index + lastPartitionMeta.amt;
	}
	List<List<Object>> queue = getQueues().get(partition);
	int total = queue.size();
	int left = total - index;
	int toTake = Math.min(left, _takeAmt);

	MemoryTransactionalSpoutMeta ret = new MemoryTransactionalSpoutMeta(
			index, toTake);
	emitPartitionBatch(tx, collector, partition, ret);
	if (toTake == 0) {
		// this is a pretty hacky way to determine when all the
		// partitions have been committed
		// wait until we've emitted max-spout-pending empty partitions
		// for the partition
		int curr = Utils.get(_emptyPartitions, partition, 0) + 1;
		_emptyPartitions.put(partition, curr);
		if (curr > _maxSpoutPending) {
			Map<Integer, Boolean> finishedStatuses = getFinishedStatuses();
			// will be null in remote mode
			if (finishedStatuses != null) {
				finishedStatuses.put(partition, true);
			}
		}
	}
	return ret;
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:36,代码来源:MemoryTransactionalSpout.java

示例3: updateTaskCounts

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
private void updateTaskCounts(List<Integer> tasks) {
    if(_currBatch!=null) {
        Map<Integer, Integer> taskEmittedTuples = _currBatch.taskEmittedTuples;
        for(Integer task: tasks) {
            int newCount = Utils.get(taskEmittedTuples, task, 0) + 1;
            taskEmittedTuples.put(task, newCount);
        }
    }
}
 
开发者ID:songtk,项目名称:learn_jstorm,代码行数:10,代码来源:TridentBoltExecutor.java

示例4: getFloat

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static float getFloat(Map<String, Object> conf, String key,
        float defaultValue) {
    Object obj = Utils.get(conf, key, defaultValue);
    if (obj instanceof Double)
        return ((Double) obj).floatValue();
    return (Float) obj;
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:8,代码来源:ConfUtils.java

示例5: emitPartitionBatch

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public MemoryTransactionalSpoutMeta emitPartitionBatch(TransactionAttempt tx, BatchOutputCollector collector, int partition,
        MemoryTransactionalSpoutMeta lastPartitionMeta) {
    if (!Boolean.FALSE.equals(getDisabledStatuses().get(partition))) {
        int index;
        if (lastPartitionMeta == null) {
            index = 0;
        } else {
            index = lastPartitionMeta.index + lastPartitionMeta.amt;
        }
        List<List<Object>> queue = getQueues().get(partition);
        int total = queue.size();
        int left = total - index;
        int toTake = Math.min(left, _takeAmt);

        MemoryTransactionalSpoutMeta ret = new MemoryTransactionalSpoutMeta(index, toTake);
        for (int i = ret.index; i < ret.index + ret.amt; i++) {
            List<Object> toEmit = new ArrayList<Object>(queue.get(i));
            toEmit.add(0, tx);
            collector.emit(toEmit);
        }
        if (toTake == 0) {
            // this is a pretty hacky way to determine when all the partitions have been committed
            // wait until we've emitted max-spout-pending empty partitions for the partition
            int curr = Utils.get(_emptyPartitions, partition, 0) + 1;
            _emptyPartitions.put(partition, curr);
            if (curr > _maxSpoutPending) {
                getFinishedStatuses().put(partition, true);
            }
        }
        return ret;
    } else {
        return null;
    }
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:36,代码来源:OpaqueMemoryTransactionalSpout.java

示例6: execute

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void execute(Tuple tuple) {
	Object key = tuple.getValue(1);
	int curr = Utils.get(_counts, key, 0);
	_counts.put(key, curr + 1);
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:7,代码来源:KeyedCountingBatchBolt.java

示例7: execute

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void execute(Tuple tuple) {
	Object key = tuple.getValue(1);
	Number curr = Utils.get(_sums, key, 0);
	_sums.put(key, Numbers.add(curr, tuple.getValue(2)));
}
 
开发者ID:zhangjunfang,项目名称:jstorm-0.9.6.3-,代码行数:7,代码来源:KeyedSummingBatchBolt.java

示例8: execute

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void execute(Tuple tuple) {
    Object key = tuple.getValue(1);
    Number curr = Utils.get(_sums, key, 0);
    _sums.put(key, Numbers.add(curr, tuple.getValue(2)));
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:7,代码来源:KeyedSummingBatchBolt.java

示例9: getInt

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static int getInt(Map<String, Object> conf, String key,
        int defaultValue) {
    Object obj = Utils.get(conf, key, defaultValue);
    return Utils.getInt(obj);
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:6,代码来源:ConfUtils.java

示例10: getLong

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static long getLong(Map<String, Object> conf, String key,
        long defaultValue) {
    return (Long) Utils.get(conf, key, defaultValue);
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:5,代码来源:ConfUtils.java

示例11: getString

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
public static String getString(Map<String, Object> conf, String key) {
    return (String) Utils.get(conf, key, null);
}
 
开发者ID:zaizi,项目名称:alfresco-apache-storm-demo,代码行数:4,代码来源:ConfUtils.java

示例12: execute

import backtype.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void execute(Tuple tuple) {
    Object key = tuple.getValue(1);
    int curr = Utils.get(_counts, key, 0);
    _counts.put(key, curr + 1);
}
 
开发者ID:kkllwww007,项目名称:jstrom,代码行数:7,代码来源:KeyedCountingBatchBolt.java


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