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


Java IBackingMap类代码示例

本文整理汇总了Java中storm.trident.state.map.IBackingMap的典型用法代码示例。如果您正苦于以下问题:Java IBackingMap类的具体用法?Java IBackingMap怎么用?Java IBackingMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: makeState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
@Override
public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) {
	// TODO Auto-generated method stub
	String curThreadName = Thread.currentThread().getName();

	CommonUtil.logMessage(logger, curThreadName, "makeState: entered partitionIndex = %d, numPartitions = %d ", 
			partitionIndex, numPartitions);
	
	String redisServerIP = (String)conf.get("redisServerIP");
	String redisServerPort = (String)conf.get("redisServerPort");
	
	CommonUtil.logMessage(logger, curThreadName, "makeState: redisServerIP = %s, redisServerPort = %s ", 
			redisServerIP, redisServerPort);
	
	IBackingMap<TransactionalValue<Long>> backMap = new RedisStoreIBackingMap(redisServerIP, redisServerPort);
	
	IBackingMap<TransactionalValue> test = generic(generic(backMap, Long.class));
	
	return new RedisStoreState(test);
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:21,代码来源:RedisStoreStateFactory.java

示例2: makeState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
@Override
public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) {
	// TODO Auto-generated method stub
	String curThreadName = Thread.currentThread().getName();

	CommonUtil.logMessage(logger, curThreadName, "makeState: entered partitionIndex = %d, numPartitions = %d ", 
			partitionIndex, numPartitions);
	
	String redisServerIP = (String)conf.get("redisServerIP");
	String redisServerPort = (String)conf.get("redisServerPort");

	
	CommonUtil.logMessage(logger, curThreadName, "makeState: redisServerIP = %s, redisServerPort = %s ", 
			redisServerIP, redisServerPort);
	
	IBackingMap<OpaqueValue<Long>> backMap = new RedisStoreIBackingMap(redisServerIP, redisServerPort);
	
	IBackingMap<OpaqueValue> test = generic(generic(backMap, Long.class));
	
	return new RedisStoreState(test);
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:22,代码来源:RedisStoreStateFactory.java

示例3: RedisStoreState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
public RedisStoreState(IBackingMap<OpaqueValue> backing) {
	super(backing);
	// TODO Auto-generated constructor stub
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:5,代码来源:RedisStoreState.java

示例4: RedisStoreState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
public RedisStoreState(IBackingMap<TransactionalValue> backing) {
	super(backing);
	// TODO Auto-generated constructor stub
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:5,代码来源:RedisStoreState.java

示例5: makeState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
@Override
public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) {
	// TODO Auto-generated method stub
	String curThreadName = Thread.currentThread().getName();

	CommonUtil.logMessage(logger, curThreadName, "makeState: entered partitionIndex = %d, numPartitions = %d ", 
			partitionIndex, numPartitions);
	
	String redisServerIP = (String)conf.get("redisServerIP");
	String redisServerPort = (String)conf.get("redisServerPort");
	Integer phraseCount = Integer.parseInt((String)conf.get("phraseCount"));

	
	CommonUtil.logMessage(logger, curThreadName, "makeState: redisServerIP = %s, redisServerPort = %s ", 
			redisServerIP, redisServerPort);
	
	//Determine failedWord - The word the presence of which should fail a trxn. - start
	String[] sentences = null;
	try {
		sentences = (String[]) IOUtils.readLines(
		    ClassLoader.getSystemClassLoader().getResourceAsStream("500_sentences_en.txt")).toArray(new String[0]);
	} catch(IOException e) {
		throw new RuntimeException(e);
	}
	Random rand = new Random();
	String failedPhrase = sentences[rand.nextInt(phraseCount)];
	CommonUtil.logMessage(logger, curThreadName, "makeState: failedPhrase = %s", 
			failedPhrase);
	//Eliminate stop words and punctuation like comma , double quotes - use Lucene
	List<String> filteredFailedPhrase = Util.filterPhrase2(failedPhrase);		 
	CommonUtil.logMessage(logger, curThreadName, "makeState: filteredFailedPhrase = %s", filteredFailedPhrase);		
	//String failOnWord = filteredFailedPhrase.get(rand.nextInt(filteredFailedPhrase.size()));
	String failOnWord = "outclass";
	CommonUtil.logMessage(logger, curThreadName, "makeState: failOnWord = %s", 
			failOnWord);
	//Determine failedWord - The word the presence of which should fail a trxn. - end

	
	IBackingMap<TransactionalValue<Long>> backMap = new RedisStoreIBackingMap(redisServerIP, redisServerPort, failOnWord);
	
	IBackingMap<TransactionalValue> test = generic(generic(backMap, Long.class));
	
	return new RedisStoreState(test);
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:45,代码来源:RedisStoreStateFactory.java

示例6: makeState

import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
@Override
public State makeState(Map conf, IMetricsContext metrics, int partitionIndex, int numPartitions) {
	// TODO Auto-generated method stub
	String curThreadName = Thread.currentThread().getName();

	CommonUtil.logMessage(logger, curThreadName, "makeState: entered partitionIndex = %d, numPartitions = %d ", 
			partitionIndex, numPartitions);
	
	String redisServerIP = (String)conf.get("redisServerIP");
	String redisServerPort = (String)conf.get("redisServerPort");
	Integer phraseCount = Integer.parseInt((String)conf.get("phraseCount"));

	
	CommonUtil.logMessage(logger, curThreadName, "makeState: redisServerIP = %s, redisServerPort = %s ", 
			redisServerIP, redisServerPort);
	
	//Determine failedWord - The word the presence of which should fail a trxn. - start
			String[] sentences = null;
			try {
				sentences = (String[]) IOUtils.readLines(
				    ClassLoader.getSystemClassLoader().getResourceAsStream("500_sentences_en.txt")).toArray(new String[0]);
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
			Random rand = new Random();
			String failedPhrase = sentences[rand.nextInt(phraseCount)];
			CommonUtil.logMessage(logger, curThreadName, "makeState: failedPhrase = %s", 
					failedPhrase);
			//Eliminate stop words and punctuation like comma , double quotes - use Lucene
			List<String> filteredFailedPhrase = Util.filterPhrase2(failedPhrase);		 
			CommonUtil.logMessage(logger, curThreadName, "makeState: filteredFailedPhrase = %s", filteredFailedPhrase);		
			//String failOnWord = filteredFailedPhrase.get(rand.nextInt(filteredFailedPhrase.size()));
			String failOnWord = "outclass";
			CommonUtil.logMessage(logger, curThreadName, "makeState: failOnWord = %s", 
					failOnWord);
			//Determine failedWord - The word the presence of which should fail a trxn. - end
	
	IBackingMap<OpaqueValue<Long>> backMap = new RedisStoreIBackingMap(redisServerIP, redisServerPort, failOnWord);
	
	IBackingMap<OpaqueValue> test = generic(generic(backMap, Long.class));
	
	return new RedisStoreState(test);
}
 
开发者ID:BinitaBharati,项目名称:storm-trident-example,代码行数:44,代码来源:RedisStoreStateFactory.java


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