Checks whether the given flow has an active (running, non-dispatched) executions {@inheritDoc}

@see azkaban.executor.ExecutorManagerAdapter#isFlowRunning(int, java.lang.String)
425212
@Override
  public boolean isFlowRunning(final int projectId, final String flowId) {
    boolean isRunning = false;
    isRunning =
        isRunning
            || isFlowRunningHelper(projectId, flowId, this.queuedFlows.getAllEntries());
    isRunning =
        isRunning
            || isFlowRunningHelper(projectId, flowId, this.runningExecutions.get().values());
    return isRunning;
  }
238586
@Override
    public boolean isActive() {
        try {
            validateInitialization();
        } catch (InvalidStateException ex) {
            return false;
        }
        return informerWatchDog.isActive() && serverWatchDog.isActive();
    }
1157420
public List<Integer> getRunningFlowIds() {
    final List<Integer> allIds = new ArrayList<>();
    try {
      getExecutionIdsHelper(allIds, this.executorLoader.fetchUnfinishedFlows().values());
    } catch (final ExecutorManagerException e) {
      this.logger.error("Failed to get running flow ids.", e);
    }
    return allIds;
  }
459434
def is_running(self):
        
        return self._state in [self.STATE_ACTIVE,
                               self.STATE_IDLE,
                               self.STATE_INITIALIZING]
194808
private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() {
    final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap =
        new HashMap<>();

    for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this.runningExecutions.get()
        .values()) {
      final ExecutionReference ref = runningFlow.getFirst();
      final ExecutableFlow flow = runningFlow.getSecond();
      final Optional<Executor> executor = ref.getExecutor();

      // We can set the next check time to prevent the checking of certain
      // flows.
      if (ref.getNextCheckTime() >= DateTime.now().getMillis()) {
        continue;
      }

      List<ExecutableFlow> flows = exFlowMap.get(executor);
      if (flows == null) {
        flows = new ArrayList<>();
        exFlowMap.put(executor, flows);
      }

      flows.add(flow);
    }

    return exFlowMap;
  }
873893
@Override
	public boolean isMachineRunning( TargetHandlerParameters parameters, String machineId )
	throws TargetException {

		NovaApi novaApi = novaApi( parameters.getTargetProperties());
		String zoneName = findZoneName( novaApi, parameters.getTargetProperties());
		Server server = novaApi.getServerApiForZone( zoneName ).get( machineId );

		boolean running = false;
		if( server != null )
			running = server.getStatus() == Status.ACTIVE || server.getStatus() == Status.REBOOT;

		return running;
	}
105308
def is_running(self):
        
        return self._process.state() in [self._process.Running, self._process.Starting]
295669
private Map<Optional<Executor>, List<ExecutableFlow>> getFlowToExecutorMap() {
    final HashMap<Optional<Executor>, List<ExecutableFlow>> exFlowMap = new HashMap<>();
    try {
      for (final Pair<ExecutionReference, ExecutableFlow> runningFlow : this
          .executorLoader.fetchActiveFlows().values()) {
        final Optional<Executor> executor = runningFlow.getFirst().getExecutor();
        List<ExecutableFlow> flows = exFlowMap.get(executor);
        if (flows == null) {
          flows = new ArrayList<>();
          exFlowMap.put(executor, flows);
        }
        flows.add(runningFlow.getSecond());
      }
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get flow to executor map");
    }
    return exFlowMap;
  }
108921
public boolean isRunning()
  {
    if (tc.isEntryEnabled())
    {
      SibTr.entry(tc, "isRunning");
      SibTr.exit(tc, "isRunning", new Boolean(_isRunning));
    }
    
    return _isRunning;
  }
589345
public void raInactive() {
		sbbInterface.setActive(false);
		activities = null;
		client.shutdown();
		client=null;
		executorService.shutdown();
		executorService = null;
	}
995908
@Trivial
    private void performAction(Runnable action, boolean addToQueue) {
        ExecutorService exec = executorService.getService();

        if (exec == null) {
            // If we can't find the executor service, we have to run it in place.
            action.run();
        } else {
            // If we can find the executor service, we'll add the action to the queue.
            // If the actionFuture is null (no pending actions) and the configFuture is null (no
            // pending configuration updates), we'll submit the actionsRunner to the executor
            // service to drain the queue
            //
            // configFuture is used to avoid bouncing the endpoint multiple times because of a
            // single configuration update.
            //
            // actionFuture is only set to a non-null value by kicking off the executor service here.
            // actionsRunner syncs on actionQueue, so we can't add any new actions while we are
            // draining the queue. When the queue is empty, actionFuture is explicitly set to null.
            //
            // Long story short, it prevents us from kicking off multiple executors which could run in
            // random order.
            if (addToQueue) {
                synchronized (actionQueue) {
                    actionQueue.add(action);
                    if ((actionFuture == null) && (configFuture == null)) {
                        actionFuture = exec.submit(actionsRunner);
                    }
                }
            } else {
                // Schedule immediately
                exec.submit(action);
            }
        }
    }
446156
private void checkRunnable(Class<?> type) {
    if(Runnable.class.isAssignableFrom(type)) {
      try{
        this.method = type.getMethod("run");
      } catch(Exception e) {
        throw new RuntimeException("Cannot get run method of runnable class.", e);
      }
    }
  }
577969
@Override
	public boolean isCurrentlyRunning(JobKey jobKey, Trigger trigger) throws SchedulerException {
		List<JobExecutionContext> executingJobs = scheduler.getCurrentlyExecutingJobs();
		JobDetail jobDetail = scheduler.getJobDetail(jobKey);
		Trigger triggerFound = findTrigger(jobKey.getGroup(), jobKey.getName(), trigger.getKey().getGroup(), trigger.getKey().getName());
		for (JobExecutionContext jobExecutionContext : executingJobs) {
			JobDetail execJobDetail = jobExecutionContext.getJobDetail();
			if (execJobDetail.getKey().equals(jobDetail.getKey())
					&& jobExecutionContext.getTrigger().getKey().equals(triggerFound.getKey())) {
				if (LOGGER.isTraceEnabled()) 
					LOGGER.trace(String.format("found running trigger for jobkey: (%s, %s, %s)", 
							jobKey.getGroup(), jobKey.getName(), trigger.getKey().getName()));
				return true;
			}
		}
		return false;
	}
252139
private function isRunning()
    {
        if (!is_resource($this->process)) {
            return false;
        }

        $status = proc_get_status($this->process);

        return $status['running'];
    }
693589
@SuppressWarnings("unchecked")
  public void updateExecutions() {
    this.updaterStage.set("Starting update all flows.");
    final Map<Optional<Executor>, List<ExecutableFlow>> exFlowMap = getFlowToExecutorMap();
    final ArrayList<ExecutableFlow> finalizeFlows =
        new ArrayList<>();

    for (final Map.Entry<Optional<Executor>, List<ExecutableFlow>> entry : exFlowMap
        .entrySet()) {

      final Optional<Executor> executorOption = entry.getKey();
      if (!executorOption.isPresent()) {
        for (final ExecutableFlow flow : entry.getValue()) {
          logger.warn("Finalizing execution " + flow.getExecutionId()
              + ". Executor id of this execution doesn't exist");
          finalizeFlows.add(flow);
        }
        continue;
      }
      final Executor executor = executorOption.get();

      this.updaterStage.set("Starting update flows on " + executor.getHost() + ":"
          + executor.getPort());

      Map<String, Object> results = null;
      try {
        results = this.apiGateway.updateExecutions(executor, entry.getValue());
      } catch (final ExecutorManagerException e) {
        handleException(entry, executor, e, finalizeFlows);
      }

      if (results != null) {
        final List<Map<String, Object>> executionUpdates =
            (List<Map<String, Object>>) results
                .get(ConnectorParams.RESPONSE_UPDATED_FLOWS);
        for (final Map<String, Object> updateMap : executionUpdates) {
          try {
            final ExecutableFlow flow = updateExecution(updateMap);

            this.updaterStage.set("Updated flow " + flow.getExecutionId());

            if (ExecutionControllerUtils.isFinished(flow)) {
              finalizeFlows.add(flow);
            }
          } catch (final ExecutorManagerException e) {
            final ExecutableFlow flow = e.getExecutableFlow();
            logger.error(e);

            if (flow != null) {
              logger.warn("Finalizing execution " + flow.getExecutionId());
              finalizeFlows.add(flow);
            }
          }
        }
      }
    }

    this.updaterStage.set("Finalizing " + finalizeFlows.size() + " error flows.");

    for (final ExecutableFlow flow : finalizeFlows) {
      this.executionFinalizer
          .finalizeFlow(flow, "Not running on the assigned executor (any more)", null);
    }

    this.updaterStage.set("Updated all active flows. Waiting for next round.");
  }
365510
public void run () {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "run");

    //A thread is now processing the queue.
    running = true;

    /*
     *Can't use the running flag here as can allow multiple threads to be running at the same time. For example:
     *
     *Thread 1 is performing run processing, there is nothing left on the queue so it sets running to false.
     *Another thread calls enqueue, running is false so another thread, thread 2 is started.
     *Thread 2 enters the run method and sets running to true.
     *Thread 1 loops round, reads the running flag which is now true so carries on processing. We now get two threads in the run method.
     */
    boolean continueProcessing = true;

    while (continueProcessing) { // Thread should still run
      try {
        //Get invocation but don't dequeue it.
        //Only perform dequeue once invocation has been invoked otherwise a race condition can arise with threads
        //that are dispatching to all non-empty dispatch queues. See defect 538065 for more details.
        final AbstractInvocation invocation = head();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "invocation=" + invocation);

        final Dispatchable dispatchable = invocation.getDispatchable();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "dispatchable="+ dispatchable);

        //Whether the invocation should be repooled after it has been invoked.
        boolean repoolInvocation = false;

        //Need to be got when holding lock on invocation.
        final int size;
        final Conversation.ConversationType conversationType;

        // Synchronize on the item as it may have been dispatched to all queues, in
        // which case we do not want to risk corrupting its reference count.
        synchronized (invocation) {
          invocation.decrementReferenceCount();

          // If this this the last thread to 'see' the invocation - and it is ready (ie. the thread that
          // queued it is no longer considering invoking it) then invoke the method represented by the
          // invocation object.
          if (invocation.getReferenceCount() == 0 && invocation.isReady()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Invoking: "+ invocation);

            invocation.invoke();

            final ConversationImpl convImpl = (ConversationImpl)invocation.getConversation();
            synchronized (convImpl.getTotalOutstandingRequestCountLock()) {
              convImpl.decrementTotalOutstandingCount();

              // Check to see if we have processed all outstanding invocation requests
              // for the conversation.  If so, deliver any errors to the SIConnections
              // event listener.  This prevents error delivery preceeding responses to
              // API calls that might have generated the error.
              if (convImpl.getTotalOutstandingRequestCount() == 0) {
                final AbstractInvocation errorInvoc = convImpl.getErrorOccurredInvocation();
                if (errorInvoc != null) {
                  errorInvoc.invoke();
                  errorInvoc.repool();
                  convImpl.setErrorOccurredInvocation(null);
                }
              }
            }

            //Now that invocation has been invoked, repool it.
            repoolInvocation = true;
          } else {
            //AbstractInvocation.toString includes refCount and ready flag information so no need for extra information.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Not invoking " + invocation + " at this time");
          }


          //Need to do this when holding the invocation lock in order to ensure values don't get reset by another
          //thread repooling invocation at the same.
          size = invocation.getSize();

          final Connection connection = invocation.getConnection();
          if (connection != null) {
            conversationType = connection.getConversationType();
          } else {
            conversationType = null;
          }
        }

        //We are now done with invocation, dequeue it regardless of whether we invoked it or not.
        dequeue();

        //Unlock barrier using stashed information.
        unlockBarrier(size, conversationType);

        //All done, repool invocation.
        if(repoolInvocation) invocation.repool();

        // Reduce the conversation's use count for this dispatch queue.
        // If this hits zero then disassociate the conversation from this queue.

        synchronized (dispatchable.getDispatchLockObject()) {
          dispatchable.decrementDispatchQueueRefCount();
          if (dispatchable.getDispatchQueueRefCount() == 0) {
            dispatchable.setDispatchQueue(null);
          }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Dispatchable refCount = " + dispatchable.getDispatchQueueRefCount());

        // The queue may now be empty but to ensure correct synchronisation with enqueue synchronise on this object

        synchronized (this) {
          if (isEmpty()) {
            if (emptyDispatchQueues != null) {
              synchronized (emptyDispatchQueues) {
                emptyDispatchQueues.add(this);
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Added this queue (" + this + ") to empty dispatch list ("+emptyDispatchQueues+")");
              }
            }

            // Sleep for a few seconds to see if more work comes in. This is done to avoid the contention on the WAS
            // threadpool that backs the dispatch queues.

            try {
              if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Thread waiting " + rldThreadRepoolDelay + "ms for new work to arrive");
              wait(rldThreadRepoolDelay);
            } catch (InterruptedException e) {
              // No FFDC Code Needed
            }

            //Do we need to continue processing?
            continueProcessing = !isEmpty();

            // If we are to continue processing remove ourselves from the emptyDispatchQueues list
            if (continueProcessing) {
              if (emptyDispatchQueues != null) {
                synchronized (emptyDispatchQueues) {
                  emptyDispatchQueues.remove(this);
                  if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Removed this queue (" + this + ") from empty dispatch list ("+emptyDispatchQueues+")");
                }
              }
            }

            //Indicate whether a new thread needs to be started to process future work.
            running = continueProcessing;
          }
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "continue running thread="+continueProcessing);
        }
      } catch(Throwable e) {
        FFDCFilter.processException(e, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ReceiveListenerDispatchQueue.run", JFapChannelConstants.RLDISPATCHQUEUE_RUN_01, this);
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "ReceiveListenerDispatchQueue thread caught exception: ", e);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, e);
      }
    } // while (continueProcessing)

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "run");
  }
1180822
protected boolean hasOngoingTransaction() {
		if(!isSupervisedMode()) {
			return false;
		} else {
			if(ongoingTransactions != null) {
				for (Transaction transaction : ongoingTransactions) {
					if(TransactionState.CALLING.equals(transaction.getState()) ||
						TransactionState.TRYING.equals(transaction.getState()) ||
						TransactionState.PROCEEDING.equals(transaction.getState()) ||
						TransactionState.COMPLETED.equals(transaction.getState()) ||
						TransactionState.CONFIRMED.equals(transaction.getState())) {
							return true;
					}
				}
			}
			return false;
		}
	}