Package java.util.concurrent

Examples of java.util.concurrent.ExecutorCompletionService.submit()


    private void concurrentProcess(Map<Long, List<AlarmRule>> rules) {
        ExecutorCompletionService completionExecutor = new ExecutorCompletionService(executor);
        List<Future> futures = new ArrayList<Future>();
        for (Entry<Long, List<AlarmRule>> entry : rules.entrySet()) {
            final List<AlarmRule> alarmRules = entry.getValue();
            futures.add(completionExecutor.submit(new Callable<Object>() {

                @Override
                public Object call() throws Exception {
                    pipelineMonitor.explore(alarmRules);
                    return null;
View Full Code Here


      ExecutorCompletionService ecs = new ExecutorCompletionService(executor);

      final TaskContextImpl taskContext = new TaskContextImpl();
      int count = 0;
      for (final DirectoryLoaderAdaptor dir : openDirectories.values()) {
         ecs.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
               final HashSet<MarshalledEntry> allInternalEntries = new HashSet<MarshalledEntry>();
               dir.loadAllEntries(allInternalEntries, Integer.MAX_VALUE, ctx.getMarshaller());
               for (MarshalledEntry me : allInternalEntries) {
View Full Code Here

    try
    {
      Object localObject1 = null;
      long l1 = paramBoolean ? System.nanoTime() : 0L;
      Iterator localIterator1 = paramCollection.iterator();
      localArrayList.add(localExecutorCompletionService.submit((Callable)localIterator1.next()));
      i--;
      int j = 1;
      while (true)
      {
        Future localFuture1 = localExecutorCompletionService.poll();
View Full Code Here

        Future localFuture1 = localExecutorCompletionService.poll();
        if (localFuture1 == null)
          if (i > 0)
          {
            i--;
            localArrayList.add(localExecutorCompletionService.submit((Callable)localIterator1.next()));
            j++;
          }
          else
          {
            if (j == 0)
View Full Code Here

    private void concurrentProcess(Map<Long, List<AlarmRule>> rules) {
        ExecutorCompletionService completionExecutor = new ExecutorCompletionService(executor);
        List<Future> futures = new ArrayList<Future>();
        for (Entry<Long, List<AlarmRule>> entry : rules.entrySet()) {
            final List<AlarmRule> alarmRules = entry.getValue();
            futures.add(completionExecutor.submit(new Callable<Object>() {

                @Override
                public Object call() throws Exception {
                    pipelineMonitor.explore(alarmRules);
                    return null;
View Full Code Here

    private void concurrentProcess(List<Long> channelIds) {
        ExecutorCompletionService completionExecutor = new ExecutorCompletionService(executor);
        List<Future> futures = new ArrayList<Future>();
        for (final Long channelId : channelIds) {
            futures.add(completionExecutor.submit(new Callable<Object>() {

                @Override
                public Object call() throws Exception {
                    ChannelStatus status = arbitrateManageService.channelEvent().status(channelId);
                    if (status.isPause()) {
View Full Code Here

               Bucket bucket = unmarshallBucket(binaryStream);
               bucket.setBucketId(bucketId);
               expiredBuckets.add(bucket);
               if (expiredBuckets.size() == BATCH_SIZE) {
                  ++tasksScheduled;
                  ecs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));
                  expiredBuckets = new ArrayList<Bucket>(BATCH_SIZE);
               }
            } else {
               if (log.isTraceEnabled()) {
                  log.tracef("Could not acquire write lock for %s, this won't be purged even though it has expired elements", bucketId);
View Full Code Here

            tasksCompleted += unlockCompleted(ecs, false); // cannot throw InterruptedException
         }

         if (!expiredBuckets.isEmpty()) {
            ++tasksScheduled;
            ecs.submit(new BucketPurger(expiredBuckets, task, ctx.getMarshaller(), conn, emptyBuckets));
         }
         // wait until all tasks have completed
         try {
            while (tasksCompleted < tasksScheduled) {
               tasksCompleted += unlockCompleted(ecs, true);
View Full Code Here

        while (gridLoc != null) {
            Map<String, String> fullParameters = tr.getParameters();

            final ConveyorTile tile = new ConveyorTile(storageBroker, layerName, tr.getGridSetId(), gridLoc,
                    tr.getMimeType(), fullParameters, null, null);
            futures.add(completer.submit(new Callable<ConveyorTile>() {

                public ConveyorTile call() throws Exception {
                    try {
                        return tl.getTile(tile);
                    } catch (OutsideCoverageException oce) {
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.