Examples of TaskRunner


Examples of com.subhajit.gui.progress.TaskRunner

    }
    new Thread(new Runnable() {
      public void run() {
        final ConcurrentMap<File, Set<File>> filesMap = new ConcurrentHashMap<File, Set<File>>();
        final ConcurrentMap<File, Graph<String>> nodes = new ConcurrentHashMap<File, Graph<String>>();
        new TaskRunner(new ISwingRunnableWithProgress() {
          public void run(IProgress progress) throws Throwable {
            LWRepository repository = GenerateDependenciesActionHandler.this.jarPanel.repository;
            filesMap.putAll(updateFilesMap(repository, progress));

            progress.setRange(0, filesMap.entrySet().size());
            for (Map.Entry<File, Set<File>> entry : filesMap
                .entrySet()) {
              progress.increment(1, "");
              Graph<String> sourceNode = ensureNodeExists(nodes,
                  entry.getKey());
              for (File usedFile : entry.getValue()) {
                if (!usedFile.equals(entry.getKey())) {
                  Graph<String> targetNode = ensureNodeExists(
                      nodes, usedFile);
                  boolean alreadyParent = false;
                  for (Graph<String> child : sourceNode
                      .getChildren()) {
                    if (child == targetNode) {
                      alreadyParent = true;
                      break;
                    }
                  }
                  if (!alreadyParent) {
                    sourceNode.addChild(targetNode);
                  }
                }
              }
            }
          }
        }, "", "", 0).exec();
        new TaskRunner(new ISwingRunnableWithProgress() {
          public void run(IProgress progress) throws Throwable {
            progress.setRange(0, nodes.entrySet().size());
            File temporaryDir = new File(
                IConstants.JAVA_IO_TMPDIR_PATH + "/"
                    + UUID.randomUUID().toString());
View Full Code Here

Examples of io.druid.indexing.overlord.TaskRunner

  }

  @Override
  public Optional<InputSupplier<InputStream>> streamTaskLog(String taskid, long offset) throws IOException
  {
    final TaskRunner runner = taskMaster.getTaskRunner().orNull();
    if (runner instanceof TaskLogStreamer) {
      return ((TaskLogStreamer) runner).streamTaskLog(taskid, offset);
    } else {
      return Optional.absent();
    }
View Full Code Here

Examples of net.pms.util.TaskRunner

    }
  }

  @Test
  public void simpleScheduledTasks() throws InterruptedException {
    TaskRunner tk = new TaskRunner();

    final Counter c = new Counter();

    for (int i = 0; i < 3; i++) {
      tk.submitNamed("myTask", new Runnable() {
        @Override
        public void run() {
          c.incr();
        }
      });
    }
    tk.shutdown();
    tk.awaitTermination(1, TimeUnit.DAYS);
    assertEquals("all 3 task is executed", 3, c.x);
  }
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

            try {
                oneway(DISCONNECT);
            } catch (Exception ignore) {
            }

            TaskRunner tr = null;
            try {
                enqueueValve.turnOff();
                if (!disposed) {
                    started = false;
                    disposed = true;
                    if (taskRunner != null) {
                        tr = taskRunner;
                        taskRunner = null;
                    }
                }
            } finally {
                stopping.set(false);
                enqueueValve.turnOn();
            }
            if (tr != null) {
                tr.shutdown(1000);
            }
        }
    }
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

                peer.transportListener.onCommand(new ShutdownInfo());
            } catch (Exception ignore) {
            }
         
         
            TaskRunner tr = null;
            try {
                enqueueValve.turnOff();
                if (!disposed) {
                    started = false;
                    disposed = true;
                    if (taskRunner != null) {
                        tr = taskRunner;
                        taskRunner = null;
                    }
                }
            } finally {
                stopping.set(false);
                enqueueValve.turnOn();
            }
            if (tr != null) {
                tr.shutdown(1000);
            }
           

        }
       
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

            try {
                oneway(DISCONNECT);
            } catch (Exception ignore) {
            }

            TaskRunner tr = null;
            try {
                enqueueValve.turnOff();
                if (!disposed) {
                    started = false;
                    disposed = true;
                    if (taskRunner != null) {
                        tr = taskRunner;
                        taskRunner = null;
                    }
                }
            } finally {
                stopping.set(false);
                enqueueValve.turnOn();
            }
            if (tr != null) {
                tr.shutdown(1000);
            }
        }
    }
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

    public void stop() throws Exception {
        // Only need to do this once, all future oneway calls will now
        // fail as will any asnyc jobs in the task runner.
        if (disposed.compareAndSet(false, true)) {

            TaskRunner tr = taskRunner;
            LinkedBlockingQueue<Object> mq = this.messageQueue;

            taskRunner = null;
            messageQueue = null;

            if (mq != null) {
                mq.clear();
            }

            // Allow pending deliveries to finish up, but don't wait
            // forever in case of an stalled onCommand.
            if (tr != null) {
                try {
                    tr.shutdown(TimeUnit.SECONDS.toMillis(1));
                } catch(Exception e) {
                }
            }

            // let the peer know that we are disconnecting after attempting
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

        }
        return result;
    }

    protected TaskRunner getTaskRunner() throws TransportDisposedIOException {
        TaskRunner result = taskRunner;
        if (result == null) {
            synchronized (this) {
                result = taskRunner;
                if (result == null) {
                    if (disposed.get()) {
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

        // local VMTransport dispatcher is artificially delayed.
        final TaskRunnerFactory realTaskRunnerFactory = localBroker
                .getTaskRunnerFactory();
        localBroker.setTaskRunnerFactory(new TaskRunnerFactory() {
            public TaskRunner createTaskRunner(Task task, String name) {
                final TaskRunner realTaskRunner = realTaskRunnerFactory
                        .createTaskRunner(task, name);
                if (name.startsWith("ActiveMQ Connection Dispatcher: ")) {
                    return new TaskRunner() {
                        @Override
                        public void shutdown() throws InterruptedException {
                            realTaskRunner.shutdown();
                        }

                        @Override
                        public void shutdown(long timeout)
                                throws InterruptedException {
                            realTaskRunner.shutdown(timeout);
                        }

                        @Override
                        public void wakeup() throws InterruptedException {
                            Thread.sleep(taskRunnerDelay);
                            realTaskRunner.wakeup();
                        }
                    };
                } else {
                    return realTaskRunnerFactory.createTaskRunner(task, name);
                }
View Full Code Here

Examples of org.apache.activemq.thread.TaskRunner

    public void wakeup() {
        if (!dispatchedBySessionPool) {
            if (session.isSessionAsyncDispatch()) {
                try {
                    TaskRunner taskRunner = this.taskRunner;
                    if (taskRunner == null) {
                        synchronized (this) {
                            if (this.taskRunner == null) {
                                if (!isRunning()) {
                                    // stop has been called
                                    return;
                                }
                                this.taskRunner = session.connection.getSessionTaskRunner().createTaskRunner(this,
                                        "ActiveMQ Session: " + session.getSessionId());
                            }
                            taskRunner = this.taskRunner;
                        }
                    }
                    taskRunner.wakeup();
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                }
            } else {
                while (iterate()) {
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.