本文整理汇总了Java中org.infinispan.persistence.PersistenceUtil类的典型用法代码示例。如果您正苦于以下问题:Java PersistenceUtil类的具体用法?Java PersistenceUtil怎么用?Java PersistenceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistenceUtil类属于org.infinispan.persistence包,在下文中一共展示了PersistenceUtil类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: process
import org.infinispan.persistence.PersistenceUtil; //导入依赖的package包/类
@Override
public void process(KeyFilter filter, CacheLoaderTask task, Executor executor, boolean fetchValue,
boolean fetchMetadata) {
int batchSize = 100;
ExecutorCompletionService ecs = new ExecutorCompletionService(executor);
int tasks = 0;
final TaskContext taskContext = new TaskContextImpl();
List<Map.Entry<Object, byte[]>> entries = new ArrayList<Map.Entry<Object, byte[]>>(batchSize);
try {
for (Map.Entry<Object, byte[]> entry : store.entrySet()) {
entries.add(entry);
if (entries.size() == batchSize) {
final List<Map.Entry<Object, byte[]>> batch = entries;
entries = new ArrayList<Map.Entry<Object, byte[]>>(batchSize);
submitProcessTask(task, filter, ecs, taskContext, batch);
tasks++;
}
}
if (!entries.isEmpty()) {
submitProcessTask(task, filter,ecs, taskContext, entries);
tasks++;
}
PersistenceUtil.waitForAllTasksToComplete(ecs, tasks);
} catch (Exception e) {
throw new CacheLoaderException(e);
}
}
示例2: size
import org.infinispan.persistence.PersistenceUtil; //导入依赖的package包/类
@Override
public int size() {
return PersistenceUtil.count(this, null);
}