本文整理匯總了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);
}