Package org.infinispan.executors

Examples of org.infinispan.executors.ExecutorAllCompletionService.submit()


                  InputStream binaryStream = rs.getBinaryStream(1);
                  bucket = unmarshallBucket(binaryStream);
                  bucket.setBucketId(bucketId);
                  expiredBuckets.add(bucket);
                  if (expiredBuckets.size() == batchSize) {
                     eacs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));
                     taskCount++;
                     expiredBuckets = new HashSet<Bucket>(batchSize);
                  }
               } else {
                  if (log.isTraceEnabled()) {
View Full Code Here


                  }
               }
            }

            if (!expiredBuckets.isEmpty())
               eacs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));

         } catch (Exception ex) {
            // if something happens make sure buckets locks are being release
            releaseLocks(expiredBuckets);
            log.failedClearingJdbcCacheStore(ex);
View Full Code Here

      int taskCount = 0;
      for (final Object key : keysToLoad) {
         if (taskContext.isStopped())
            break;

         eacs.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
               try {
                  final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata);
                  if (marshalledEntry != null) {
View Full Code Here

      int taskCount = 0;
      for (final Object key : keysToLoad) {
         if (taskContext.isStopped())
            break;

         eacs.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
               try {
                  final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata);
                  if (marshalledEntry != null) {
View Full Code Here

      int numCores = Runtime.getRuntime().availableProcessors();
      int splittingSize = Math.max(list.size() / (numCores << 2), 128);
      List<List<Map.Entry<K, V>>> partition = splitIntoLists(list, splittingSize);
      ExecutorAllCompletionService eacs = new ExecutorAllCompletionService(executor);
      for (final List<java.util.Map.Entry<K, V>> inputPartition : partition) {
         eacs.submit(new Runnable() {

            @Override
            public void run() {
               int interruptCounter = 0;
               for (Map.Entry<K, V> e : inputPartition) {
View Full Code Here

      final TaskContextImpl taskContext = new TaskContextImpl();
      for (final Object key : keysToLoad) {
         if (taskContext.isStopped())
            break;

         eacs.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
               try {
                  final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata);
                  if (marshalledEntry != null) {
View Full Code Here

         //we can do better here: ATM we load the entries in the caller's thread and process them in parallel
         // we can do the loading (expensive operation) in parallel as well.
         while (rs.next()) {
            InputStream binaryStream = rs.getBinaryStream(1);
            final Bucket bucket = unmarshallBucket(binaryStream);
            ecs.submit(new Callable<Void>() {
               @Override
               public Void call() throws Exception {
                  try {
                     for (MarshalledEntry me : bucket.getStoredEntries(filter, ctx.getTimeService()).values()) {
                        if (!taskContext.isStopped()) {
View Full Code Here

                  InputStream binaryStream = rs.getBinaryStream(1);
                  bucket = unmarshallBucket(binaryStream);
                  bucket.setBucketId(bucketId);
                  expiredBuckets.add(bucket);
                  if (expiredBuckets.size() == batchSize) {
                     eacs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));
                     taskCount++;
                     expiredBuckets = new HashSet<Bucket>(batchSize);
                  }
               } else {
                  if (log.isTraceEnabled()) {
View Full Code Here

                  }
               }
            }

            if (!expiredBuckets.isEmpty())
               eacs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));

         } catch (Exception ex) {
            // if something happens make sure buckets locks are being release
            releaseLocks(expiredBuckets);
            log.failedClearingJdbcCacheStore(ex);
View Full Code Here

      final TaskContextImpl taskContext = new TaskContextImpl();
      for (final Object key : keysToLoad) {
         if (taskContext.isStopped())
            break;

         eacs.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
               try {
                  final MarshalledEntry marshalledEntry = _load(key, fetchValue, fetchMetadata);
                  if (marshalledEntry != null) {
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.