Checks if the system is deadlocked running service jobs.
435787
def checkForDeadlocks(self):
        
        totalRunningJobs = len(self.batchSystem.getRunningBatchJobIDs())
        totalServicesIssued = self.serviceJobsIssued + self.preemptableServiceJobsIssued
        # If there are no updated jobs and at least some jobs running
        if totalServicesIssued >= totalRunningJobs and totalRunningJobs > 0:
            serviceJobs = [x for x in list(self.jobBatchSystemIDToIssuedJob.keys()) if isinstance(self.jobBatchSystemIDToIssuedJob[x], ServiceJobNode)]
            runningServiceJobs = set([x for x in serviceJobs if self.serviceManager.isRunning(self.jobBatchSystemIDToIssuedJob[x])])
            assert len(runningServiceJobs) <= totalRunningJobs

            # If all the running jobs are active services then we have a potential deadlock
            if len(runningServiceJobs) == totalRunningJobs:
                # We wait self.config.deadlockWait seconds before declaring the system deadlocked
                if self.potentialDeadlockedJobs != runningServiceJobs:
                    self.potentialDeadlockedJobs = runningServiceJobs
                    self.potentialDeadlockTime = time.time()
                elif time.time() - self.potentialDeadlockTime >= self.config.deadlockWait:
                    raise DeadlockException("The system is service deadlocked - all %d running jobs are active services" % totalRunningJobs)
            else:
                # We have observed non-service jobs running, so reset the potential deadlock
                self.potentialDeadlockedJobs = set()
                self.potentialDeadlockTime = 0
        else:
            # We have observed non-service jobs running, so reset the potential deadlock
            self.potentialDeadlockedJobs = set()
            self.potentialDeadlockTime = 0
1150886
public static boolean checkForRunningService(Context ctx, String serviceClassName) {
        ActivityManager manager = (ActivityManager) ctx.getSystemService(Context.ACTIVITY_SERVICE);
        for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
            if (serviceClassName.equals(service.service.getClassName())) {
                return true;
            }
        }
        return false;
    }
3382
private boolean checkLock(CmsResource resource) throws CmsException {

        CmsLock lock = m_cms.getLock(resource);
        return lock.isUnlocked() || lock.getUserId().equals(m_cms.getRequestContext().getCurrentUser().getId());
    }
1088389
def is_running(self):
        """"""
        if self._postmaster_proc:
            if self._postmaster_proc.is_running():
                return self._postmaster_proc
            self._postmaster_proc = None

        # we noticed that postgres was restarted, force syncing of replication
        self._schedule_load_slots = self.use_slots

        self._postmaster_proc = PostmasterProcess.from_pidfile(self._data_dir)
        return self._postmaster_proc
422583
@Override
    public boolean isLocked()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "isLocked");

        final boolean isLocked = (state == SIMPState.LOCKED);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "isLocked", Boolean.valueOf(isLocked));

        return isLocked;
    }
371077
def __checkLock(self):
        
        if self._isLocked:
            if (time.time() - self._timer) > TIMEOUT_TIMES[self._operation]:
                self.__unLock()
                return False
            return True
        return False
285480
def check_status(self):
        """"""
        # Recompute the status of the tasks
        # Ignore OK and LOCKED tasks.
        for task in self:
            if task.status in (task.S_OK, task.S_LOCKED): continue
            task.check_status()

        # Take into account possible dependencies. Use a list instead of generators
        for task in self:
            if task.status == task.S_LOCKED: continue
            if task.status < task.S_SUB and all(status == task.S_OK for status in task.deps_status):
                task.set_status(task.S_READY, "Status set to Ready")
159766
private boolean isAbandoned(final SubmittedPrintJob printJob) {
        final long duration = ThreadPoolJobManager.this.jobQueue.timeSinceLastStatusCheck(
                printJob.getEntry().getReferenceId());
        final boolean abandoned =
                duration > TimeUnit.SECONDS.toMillis(ThreadPoolJobManager.this.abandonedTimeout);
        if (abandoned) {
            LOGGER.info("Job {} is abandoned (no status check within the last {} seconds)",
                        printJob.getEntry().getReferenceId(), ThreadPoolJobManager.this.abandonedTimeout);
        }
        return abandoned;
    }
782117
def can_run(self):
        """"""
        all_ok = all(stat == self.S_OK for stat in self.deps_status)
        return self.status < self.S_SUB and self.status != self.S_LOCKED and all_ok
820943
def is_running(self):
        
        if self.block:
            return False

        return self.thread.is_alive() or self.process.poll() is None
910089
private boolean checkFailover() throws InterruptedException {
    boolean isPrimary = isPrimaryServiceCached();
    if (!isPrimary && isPrimaryService()) {
      this.servicePair.setPrimaryOfferService(this);
      return true;
    }
    return false;
  }
19052
def stalled(self, offset=0, count=25):
        ''''''
        return self.client('jobs', 'stalled', self.name, offset, count)
960469
def check_for_maintenance(self):
        '''
        
        '''
        numrevs = self.conn.get_one("SELECT count(revnum) FROM csetLog")[0]
        if numrevs >= SIGNAL_MAINTENACE_CSETS:
            return True
        return False
405744
protected void checkPaused() throws IOException {
        if (this.paused.get()) {
            synchronized (this.paused) {
                if (this.paused.get()) {
                    this.jedis.set(key(WORKER, this.name), pauseMsg());
                }
                while (this.paused.get()) {
                    try {
                        this.paused.wait();
                    } catch (InterruptedException ie) {
                        LOG.warn("Worker interrupted", ie);
                    }
                }
                this.jedis.del(key(WORKER, this.name));
            }
        }
    }
154624
private boolean is_locked(Key<Job> job_key) { 
    if( _lockers==null ) return false;
    for( int i=(_lockers.length==1?0:1); i<_lockers.length; i++ ) {
      Key k = _lockers[i];
      if( job_key==k || (job_key != null && k != null && job_key.equals(k)) ) return true;
    }
    return false;
  }
91772
def isLocked(name):
    
    l = FilesystemLock(name)
    result = None
    try:
        result = l.lock()
    finally:
        if result:
            l.unlock()
    return not result
218136
private void checkForTermination() {
    synchronized (lock) {
      if (shutdown && transports.isEmpty() && transportServersTerminated) {
        if (terminated) {
          throw new AssertionError("Server already terminated");
        }
        terminated = true;
        channelz.removeServer(this);
        if (executor != null) {
          executor = executorPool.returnObject(executor);
        }
        lock.notifyAll();
      }
    }
  }