Start this task running in this thread.
@param objJobDef The job to run in this thread.
190780
@SuppressWarnings({ "rawtypes", "unchecked" })
    public void runThread(Object objJobDef)
    {
        if (objJobDef instanceof Task)
        {
            Task task = (Task)objJobDef;
            if (task.getApplication() == null)  // init()ed yet?
                task.initTask(this.getApplication(), null);     // No, Initialize it
            task.run();
        }
        else if ((objJobDef instanceof String) || (objJobDef instanceof Properties))
        {
            String strJobDef = null;
            Map<String,Object> properties = null;
            if (objJobDef instanceof String)
            {
                strJobDef = (String)objJobDef;
                properties = new Hashtable<String,Object>();
                Util.parseArgs(properties, strJobDef);
            }
            if (objJobDef instanceof Properties)
                properties = (Map)objJobDef;
            if (properties.get("webStartPropertiesFile") != null)
                properties = this.addPropertiesFile(properties);
            String strClass = (String)properties.get(Param.TASK);
            if (strClass == null)
                strClass = (String)properties.get(Param.APPLET); // Applets are also run as tasks
            Object job = ClassServiceUtility.getClassService().makeObjectFromClassName(strClass);
            if (job instanceof Task)
            {
                ((Task)job).initTask(this.getApplication(), properties);
                ((Task)job).run();
            }
            else if (job instanceof Applet)
            { // An applet
                //new JBaseFrame("Applet", (Applet)job);
            	System.out.println("********** Applet task type needs to be fixed *********");
            }
            else if (job instanceof Runnable)
            { // A thread (Is this okay?? I already have my own thread)
//x                         new Thread((Runnable)job).start();  // No, don't start another thread
                ((Runnable)job).run();  // This should be okay, as I already have my own thread
            }
            else
                Util.getLogger().warning("Illegal job type passed to TaskScheduler: " + job);
        }
        else if (objJobDef instanceof Runnable)
            ((Runnable)objJobDef).run();
        else
            Util.getLogger().warning("Error: Illegal job type");
    }
1076772
@Override
    public Entry<Long, Future<?>> startJob(WSJobInstance jobInstance,
                                           IJobXMLSource jobXML,
                                           Properties jobParameters,
                                           long executionId) throws JobStartException {

        traceJobXML(jobXML);
        // Check BatchStatus instead of InstanceState since this narrows the window
        // of a restart changing the status after a stop has occurred.  InstanceState
        // gets changed early; whereas BatchStatus changes right before the job is executed.
        JobInstanceEntity instanceEntity = getPersistenceManagerService().getJobInstance(jobInstance.getInstanceId());
        if (instanceEntity.getBatchStatus() == BatchStatus.STOPPED) {
            // Do not continue with the execution.  Instance has been stopped.
            throw new JobStoppedOnStartException();
        }

        RuntimeJobExecution jobExecution = jobExecutionHelper.createJobStartExecution(jobInstance, jobXML, jobParameters, executionId);

        BatchJobWorkUnit batchWork = new BatchJobWorkUnit(this, jobExecution, jobExecutionStartCallbacks, jobExecutionEndCallbacks, tranMgr);
        registerExecutingJob(jobExecution.getTopLevelExecutionId(), batchWork);

        Future<?> futureWork = null;

        try {
            // Set server id and rest URL since this is now a viable execution.
            getPersistenceManagerService().updateJobExecutionServerIdAndRestUrlForStartingJob(jobExecution.getTopLevelExecutionId());
            futureWork = executorService.executeTask(batchWork, null);
        } catch (RuntimeException e) {
            workUnitCompleted(batchWork);
            throw e;
        } catch (JobStoppedException e) {
            workUnitCompleted(batchWork);
            throw new BatchContainerRuntimeException(e);
        }

        return new AbstractMap.SimpleEntry<Long, Future<?>>(jobExecution.getTopLevelExecutionId(), futureWork);
    }
226484
private void startTask(ApplicationDefinition appDef, Task task, TaskRecord taskRecord) {
        try {
            task.setParams(m_localHost, taskRecord);
            m_executor.execute(task);
        } catch (Exception e) {
            m_logger.error("Failed to start task '" + task.getTaskID() + "'", e);
        }
    }
93419
public synchronized void start() {
    if (mStopped) {
      Preconditions.checkState(mLoggingWorkerThread == null);
      mStopped = false;
      mLoggingWorkerThread = new Thread(new AuditLoggingWorker());
      mLoggingWorkerThread.setName(AUDIT_LOG_THREAD_NAME);
      mLoggingWorkerThread.start();
      LOG.info("AsyncUserAccessAuditLogWriter thread started.");
    }
  }
949352
private void start() {
        setStatus(STARTING);
        jobListener.beforeJobStart(parameters);
        recordTracker = new RecordTracker();
        metrics.setStartTime(System.currentTimeMillis());
        LOGGER.info("Batch size: {}", parameters.getBatchSize());
        LOGGER.info("Error threshold: {}", formatErrorThreshold(parameters.getErrorThreshold()));
        LOGGER.info("Jmx monitoring: {}", parameters.isJmxMonitoring());
        registerJobMonitor();
    }
707807
public void runTask() {
        MainTask tasks[] = new MainTask[jTableAlgorithms.getModel().getRowCount() * jTableStreams.getModel().getRowCount()];
        int taskCount = 0;

        String dir = "";

        try {
            this.currentTask = (MainTask) ClassOption.cliStringToObject(
                    this.jTextFieldTask.getText(), MainTask.class, null);
        } catch (Exception ex) {
            Logger.getLogger(TaskManagerTabPanel.class.getName()).log(Level.SEVERE, null, ex);
        }
        MainTask auxTask = (MainTask) this.currentTask.copy();

        dir += this.resultsPath;

        File f = new File(dir);
        if (f.exists()) {
            Object[] options = {"Yes", "No"};
            String cancel = "NO";
            int resp = JOptionPane.showOptionDialog(this,
                    "The selected folder is not empty. This action may overwrite "
                    + "previous experiment results. Do you want to continue?", "Warning",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, cancel);
            if (resp == JOptionPane.OK_OPTION) {
                ReadFile.deleteDrectory(f);

            } else {
                JOptionPane.showMessageDialog(this, "Please specify another directory", "Message",
                        JOptionPane.INFORMATION_MESSAGE);
                return;
            }
        }
        f.mkdir();

        String algNames = "";
        String streamNames = "";
        for (int i = 0; i < jTableAlgorithms.getModel().getRowCount(); i++) {
            String alg = jTableAlgorithms.getModel().getValueAt(i, 0).toString();
            String algFile = jTableAlgorithms.getModel().getValueAt(i, 1).toString();
            algNames += algFile;
            if (i != jTableAlgorithms.getModel().getRowCount() - 1) {
                algNames += ",";
            }
            for (int j = 0; j < jTableStreams.getModel().getRowCount(); j++) {
                String stream = jTableStreams.getModel().getValueAt(j, 0).toString();
                String streamFile = jTableStreams.getModel().getValueAt(j, 1).toString();
                streamNames += streamFile.split(" ")[0];
                if (j != jTableStreams.getModel().getRowCount() - 1) {
                    streamNames += ",";
                }
                if (i == 0) {
                    String sfile = FilenameUtils.separatorsToSystem(dir + "\\\\" + streamFile);
                    f = new File(sfile);
                    f.mkdir();
                }
                String task = " -l ";
                if (alg.split(" ") != null) {
                    task += "(" + alg + ") -s (" + stream + ")" + " -d (" + dir + File.separator
                            + streamFile.split(" ")[0] + File.separator + algFile + ".txt" + ")";
                } else {
                    task += alg + " -s (" + stream + ")" + " -d (" + dir + File.separator
                            + streamFile.split(" ")[0] + File.separator + algFile + ".txt" + ")";
                }
//                String task = FilenameUtils.separatorsToSystem(" -l (" + alg + ") -s (" + stream + ") " + " -d " + "(" + dir + "\\\\"
//                        + streamFile.split(" ")[0] + "\\\\" + algFile + ".txt" + ")");
                auxTask.getOptions().setViaCLIString(task);

                try {
                    tasks[taskCount] = (MainTask) auxTask.copy();
                } catch (Exception ex) {
                    Logger.getLogger(TaskManagerTabPanel.class.getName()).log(Level.SEVERE, null, ex);
                }

                taskCount++;
            }
        }
        this.jButtonRun.setEnabled(false);
        Buffer buffer = new Buffer(tasks);
        int proc = 1;
        if (!this.jTextFieldProcess.getText().equals("")) {
            proc = Integer.parseInt(this.jTextFieldProcess.getText());
        }
        if (proc > tasks.length) {
            proc = tasks.length;
        }
        for (int i = 0; i < proc; i++) {
            ExpTaskThread thread = new ExpTaskThread(buffer);
            thread.start();
            this.taskList.add(0, thread);
            this.taskTableModel.fireTableDataChanged();
            this.taskTable.setRowSelectionInterval(0, 0);

        }
        Thread obs = new Thread() {
            public void run() {
                while (true) {
                    int count = 0;
                    for (ExpTaskThread thread : TaskManagerTabPanel.this.taskList) {
                        if (thread.isCompleted == true) {
                            count++;
                            //System.out.println(count);
                        }
                    }
                    if (count == TaskManagerTabPanel.this.taskList.size()) {
                        TaskManagerTabPanel.this.summary.readData(resultsPath);
                        TaskManagerTabPanel.this.plot.readData(resultsPath);
                        TaskManagerTabPanel.this.analizeTab.readData(resultsPath);
                        TaskManagerTabPanel.this.jButtonRun.setEnabled(true);
                        break;
                    }
                }
            }
        };
        obs.start();
    }
703197
private void runJob(Job jobToRun) {
		long startExecutionTime = timeProvider.currentTime();
		long timeBeforeNextExecution = jobToRun.nextExecutionTimeInMillis() - startExecutionTime;
		if(timeBeforeNextExecution < 0) {
			logger.debug("Job '{}' execution is {}ms late", jobToRun.name(), -timeBeforeNextExecution);
		}
		jobToRun.status(JobStatus.RUNNING);
		jobToRun.lastExecutionStartedTimeInMillis(startExecutionTime);
		jobToRun.threadRunningJob(Thread.currentThread());

		try {
			jobToRun.runnable().run();
		} catch(Throwable t) {
			logger.error("Error during job '{}' execution", jobToRun.name(), t);
		}
		jobToRun.executionsCount(jobToRun.executionsCount() + 1);
		jobToRun.lastExecutionEndedTimeInMillis(timeProvider.currentTime());
		jobToRun.threadRunningJob(null);

		if(logger.isDebugEnabled()) {
			logger.debug(
				"Job '{}' executed in {}ms", jobToRun.name(),
				timeProvider.currentTime() - startExecutionTime
			);
		}

		if(shuttingDown) {
			return;
		}
		synchronized (this) {
			scheduleNextExecution(jobToRun);
		}
	}
65009
public void start(ExecutorService executorService, Callable<Future<R>> innerTask, ThreadContextDescriptor threadContext) {
        synchronized (this) {
            this.innerTask = innerTask;
            this.threadContext = threadContext;
            //set up the future to hold the result
            this.resultFuture = new CompletableFuture<Future<R>>();
            //submit the innerTask (wrapped by this) for execution
            this.taskFuture = executorService.submit(this);
        }
    }
815849
public void start(boolean block) throws KeeperException, InterruptedException, ExecutionException
    {
        Future<?> task = start();
        if (block) {
            task.get();
        }
    }
258013
@Override
	public Obj work(Obj cmd) throws Exception {
		if (busy.compareAndSet(false, true)) {
			doRun = true;
			updateTaskStatus(Obj.make()); // reset it
			final Callable<T> task = newTask(cmd);
			(thread = new Thread(new Runnable() {
				@Override
				public void run() {
					try {
						T result = task.call();
						onTaskSuccess(result);
						if (listener != null) {
							listener.onTaskSucceeded();
						}
						lastRun(true);
					} catch (Exception e0) {
						lastRun(false);
						onTaskError(e0);
						if (listener != null) {
							listener.onTaskFailed();
						}
					} finally {
						doRun = false;
						thread = null;
						busy.set(false);
						onTaskEnd();
						if (listener != null) {
							listener.onTaskEnded();
						}
					}
				}
			})).start();
			return super.work(cmd);
		}
		return status();
	}
747567
public void runJob()
    {
        try {
            this.currentJob = this.jobQueue.take();

            // Create a clean Execution Context
            ExecutionContext context = new ExecutionContext();

            try {
                this.executionContextManager.initialize(context);
            } catch (ExecutionContextException e) {
                throw new RuntimeException("Failed to initialize Job " + this.currentJob + " execution context", e);
            }

            this.currentJob.run();
        } catch (InterruptedException e) {
            // Thread has been stopped
        } finally {
            this.execution.removeContext();
        }
    }
367468
public void addTaskRunOnce(int startDelayTime, Runnable runnable) {
        scheduledExecutorService.schedule(runnable, startDelayTime, TimeUnit.SECONDS);
    }
980552
public void runTask()
    {
        String strProcess = this.getProperty(DBParams.PROCESS);
        BaseProcess job = (BaseProcess)ClassServiceUtility.getClassService().makeObjectFromClassName(strProcess);
        if (job != null)
        {
            this.runProcess(job, m_properties);
        }
        else
        {   // NOTE: It is not recommended to start a standalone process, since they can wreak havoc with this jvm
                // (since standalones assume complete control and often will exit(0))
            String strClass = this.getProperty("standalone"); // Applets are also run as tasks
            if ((strClass != null) && (strClass.length() > 0))
            {
                try
                {
                    if (strClass.indexOf('.') == 0)
                        strClass = Constants.ROOT_PACKAGE + strClass.substring(1);
                    Class<?> c = Class.forName(strClass);
                    // Don't instatiate the class, since I'm calling static main
                    if (c != null)
                    {
                        Class<?>[] parameterTypes = {String[].class};
                        Method method = c.getMethod("main", parameterTypes);
                        Object[] args = new Object[1];
                        Map<String,Object> properties = m_properties;   // Only passed in properties
                        String[] rgArgs = Utility.propertiesToArgs(properties);
                        args[0] = rgArgs;
                        method.invoke(null, args);
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
        }
    }
99671
public void run() {
        while (true) {
            Object obj;
            try {
                obj = messages.take();
                notifySubscribers(obj);
            } catch (InterruptedException e) {
                // restore interrupted status
                Thread.currentThread().interrupt();
            }
        }
    }
539629
def _startServiceJobs(self):
        """"""
        self.issueQueingServiceJobs()
        while True:
            serviceJob = self.serviceManager.getServiceJobsToStart(0)
            # Stop trying to get jobs when function returns None
            if serviceJob is None:
                break
            logger.debug('Launching service job: %s', serviceJob)
            self.issueServiceJob(serviceJob)
407342
protected void jobStarting()
    {
        this.jobContext.pushCurrentJob(this);

        this.observationManager.notify(new JobStartedEvent(getRequest().getId(), getType(), this.request), this);

        if (this.status instanceof AbstractJobStatus) {
            ((AbstractJobStatus<R>) this.status).setStartDate(new Date());
            ((AbstractJobStatus<R>) this.status).setState(JobStatus.State.RUNNING);

            ((AbstractJobStatus) this.status).startListening();
        }

        if (getRequest().isVerbose()) {
            if (getStatus().getRequest().getId() != null) {
                this.logger.info(LOG_BEGIN_ID, "Starting job of type [{}] with identifier [{}]", getType(),
                    getStatus().getRequest().getId());
            } else {
                this.logger.info(LOG_BEGIN, "Starting job of type [{}]", getType());
            }
        }
    }
371167
public void doBackgroundOp( final Runnable run, final boolean showWaitCursor )
  {
    final Component[] key = new Component[1];
    ExecutorService jobRunner = getJobRunner();
    if( jobRunner != null )
    {
      jobRunner.submit( () -> performBackgroundOp( run, key, showWaitCursor ) );
    }
    else
    {
      run.run();
    }
  }