當前位置: 首頁>>代碼示例>>Java>>正文


Java PersistenceUtil類代碼示例

本文整理匯總了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);
   }
}
 
開發者ID:saturnism,項目名稱:infinispan-cachestore-mapdb,代碼行數:31,代碼來源:MapDBStore.java

示例2: size

import org.infinispan.persistence.PersistenceUtil; //導入依賴的package包/類
@Override
public int size() {
   return PersistenceUtil.count(this, null);
}
 
開發者ID:danberindei,項目名稱:infinispan-cachestore-leveldb,代碼行數:5,代碼來源:LevelDBStore.java


注:本文中的org.infinispan.persistence.PersistenceUtil類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。