本文整理汇总了Java中org.apache.kafka.common.cache.LRUCache类的典型用法代码示例。如果您正苦于以下问题:Java LRUCache类的具体用法?Java LRUCache怎么用?Java LRUCache使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LRUCache类属于org.apache.kafka.common.cache包,在下文中一共展示了LRUCache类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
topicField = InsertionSpec.parse(config.getString(ConfigName.TOPIC_FIELD));
partitionField = InsertionSpec.parse(config.getString(ConfigName.PARTITION_FIELD));
offsetField = InsertionSpec.parse(config.getString(ConfigName.OFFSET_FIELD));
timestampField = InsertionSpec.parse(config.getString(ConfigName.TIMESTAMP_FIELD));
staticField = InsertionSpec.parse(config.getString(ConfigName.STATIC_FIELD));
staticValue = config.getString(ConfigName.STATIC_VALUE);
if (topicField == null && partitionField == null && offsetField == null && timestampField == null && staticField == null) {
throw new ConfigException("No field insertion configured");
}
if (staticField != null && staticValue == null) {
throw new ConfigException(ConfigName.STATIC_VALUE, null, "No value specified for static field: " + staticField);
}
schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例2: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
casts = parseFieldTypes(config.getList(SPEC_CONFIG));
wholeValueCastType = casts.get(WHOLE_VALUE_CAST);
schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例3: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, configs);
blacklist = config.getList(ConfigName.BLACKLIST);
whitelist = config.getList(ConfigName.WHITELIST);
renames = parseRenameMappings(config.getList(ConfigName.RENAME));
reverseRenames = invert(renames);
schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例4: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
Object enableConfigsVal = configs.get(SCHEMAS_ENABLE_CONFIG);
if (enableConfigsVal != null)
enableSchemas = enableConfigsVal.toString().equals("true");
serializer.configure(configs, isKey);
deserializer.configure(configs, isKey);
Object cacheSizeVal = configs.get(SCHEMAS_CACHE_SIZE_CONFIG);
if (cacheSizeVal != null)
cacheSize = Integer.parseInt((String) cacheSizeVal);
fromConnectSchemaCache = new SynchronizedCache<>(new LRUCache<Schema, ObjectNode>(cacheSize));
toConnectSchemaCache = new SynchronizedCache<>(new LRUCache<JsonNode, Schema>(cacheSize));
}
示例5: setUpCaches
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Setup(Level.Trial)
public void setUpCaches() {
lruCache = new LRUCache<>(100);
}
示例6: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> configs) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, configs);
fields = config.getList(FIELDS_CONFIG);
valueToKeySchemaCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例7: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
delimiter = config.getString(DELIMITER_CONFIG);
schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例8: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, ?> props) {
final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props);
fieldName = config.getString("field");
schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Schema, Schema>(16));
}
示例9: configure
import org.apache.kafka.common.cache.LRUCache; //导入依赖的package包/类
@Override
public void configure(Map<String, String> properties) {
schemaCache = new SynchronizedCache<>(new LRUCache<String, Schema>(CACHE_SIZE));
}