本文整理汇总了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);
}
示例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);
}
示例3: RedisStoreState
import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
public RedisStoreState(IBackingMap<OpaqueValue> backing) {
super(backing);
// TODO Auto-generated constructor stub
}
示例4: RedisStoreState
import storm.trident.state.map.IBackingMap; //导入依赖的package包/类
public RedisStoreState(IBackingMap<TransactionalValue> backing) {
super(backing);
// TODO Auto-generated constructor stub
}
示例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);
}
示例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);
}