Package org.infinispan.distexec

Examples of org.infinispan.distexec.DefaultExecutorService.submitEverywhere()


   }

   public static <K, V> Set<K> getGlobalKeySet(Cache<K, V> cache) throws InterruptedException, ExecutionException {
      if (cache.getCacheConfiguration().clustering().cacheMode().isDistributed()) {
         DefaultExecutorService des = new DefaultExecutorService(cache);
         List<Future<Set<K>>> fk = des.submitEverywhere(new GlobalKeySetTask<K, V>());
         Set<K> allKeys = new HashSet<K>();
         for(Future<Set<K>> f : fk) {
            allKeys.addAll(f.get());
         }
         return allKeys;
View Full Code Here


            int numberPerWorker = numPoints / numServers;

            DistributedExecutorService des = new DefaultExecutorService(cache);

            long start = System.currentTimeMillis();
            List<Future<Integer>> results = des.submitEverywhere(new CircleTest(numberPerWorker));

            int insideCircleCount = 0;

            for (Future<Integer> f : results) insideCircleCount += f.get();
View Full Code Here

            // Defensive copy to serialize and transmit across a network
            keys = new HashSet<Object>(cache.keySet());
         } else {
            // If cache mode is DIST, use a map/reduce task
            DistributedExecutorService des = new DefaultExecutorService(cache);
            List<Future<Set<Object>>> keysets = des.submitEverywhere(new GlobalKeysetTask(cache));
            Set<Object> combinedKeyset = new HashSet<Object>();

            for (Future<Set<Object>> keyset : keysets)
               combinedKeyset.addAll(keyset.get());
View Full Code Here

            } else {
               result = new ArrayList<Future<T>>();
               result.add(des.submit(target, taskBuilder.build()));
            }
         } else {
            result = des.submitEverywhere(taskBuilder.build());
         }
      }

      return result;
   }
View Full Code Here

      public long getTotalSize() {
         long totalSize = 0;
         DistributedExecutorService des = new DefaultExecutorService(cache);
         CacheSizer<?, ?, Integer> cacheSizer = new CacheSizer<Object, Object, Integer>();
         DistributedTaskBuilder<Integer> taskBuilder = des.createDistributedTaskBuilder(cacheSizer);
         List<Future<Integer>> futureList = des.submitEverywhere(taskBuilder.build());
        
         for (Future<Integer> future : futureList) {
            try {
               totalSize += future.get().intValue();
            } catch (InterruptedException e) {
View Full Code Here

   }

   public static <K, V> Set<K> getGlobalKeySet(Cache<K, V> cache) throws InterruptedException, ExecutionException {
      if (cache.getCacheConfiguration().clustering().cacheMode().isDistributed()) {
         DefaultExecutorService des = new DefaultExecutorService(cache);
         List<Future<Set<K>>> fk = des.submitEverywhere(new GlobalKeySetTask<K, V>());
         Set<K> allKeys = new HashSet<K>();
         for(Future<Set<K>> f : fk) {
            allKeys.addAll(f.get());
         }
         return allKeys;
View Full Code Here

        if (!shared) {
            // store is not shared so every node must return key list of the store
            List<Future<T>> futures = null;
            switch (location) {
                case EVERYWHERE:
                    futures = distributedExecutor.submitEverywhere(callable);
                    break;
                case LOCALLY:
                    futures = Collections.singletonList(distributedExecutor.submit(callable));
                    break;
            }
View Full Code Here

            int numberPerWorker = numPoints / numServers;

            DistributedExecutorService des = new DefaultExecutorService(cache);

            long start = System.currentTimeMillis();
            List<Future<Integer>> results = des.submitEverywhere(new CircleTest(numberPerWorker));

            int insideCircleCount = 0;

            for (Future<Integer> f : results) insideCircleCount += f.get();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.