Gets a thread by its assigned ID.  Internally, this method calls
getAllThreads() so be careful to only call this method once and cache
your result.
@param id The thread ID
@return The thread with this ID or null if none were found
501000
static public Thread getThread(final long id) {
        final Thread[] threads = getAllThreads();
        for (Thread thread : threads)
            if (thread.getId() == id)
                return thread;
        return null;
    }
38497
@Help(help = "Find the object of type {#} through the id")
  public T findById(final String id) throws SDKException {
    return (T) requestGet(id, clazz);
  }
867471
def can_be_executed_by(self, thread_id):
        '''
        '''
        return self.thread_id == thread_id or self.thread_id.endswith('|' + thread_id)
1304713
public static final String getThreadId() {
        String id = threadids.get();
        if (null == id) {
            // Pad the tid out to 8 characters
            id = getThreadId(Thread.currentThread());
            threadids.set(id);
        }
        return id;
    }
971170
private WeightedQueue getWeightedQueue(String id)
    {
        WeightedQueue weightedQueue = queues.get(id);
        if (weightedQueue != null)
            // queue existed
            return weightedQueue;

        WeightedQueue maybenew = new WeightedQueue(id, getWeight(id));
        weightedQueue = queues.putIfAbsent(id, maybenew);
        if (weightedQueue == null)
        {
            // created new queue: register for monitoring
            maybenew.register();
            return maybenew;
        }

        // another thread created the queue
        return weightedQueue;
    }
984295
public ActiveExecution lock(String id)
            throws Exception {
        LOGGER.debug("locking {}", id);
        if (!myLocks.contains(id)) {
            if (locking.acquire(id, null)) {
                myLocks.add(id);
                ActiveExecution ae = new ActiveExecution();
                ae.setMigrationJobId(id);
                ae.set_id(id);
                ae.setStartTime(new Date());
                return ae;
            }
        }
        return null;
    }
336843
public static String getThreadDefaultTzid() throws TimezonesException {
    final String id = threadTzid.get();

    if (id != null) {
      return id;
    }
    return getSystemDefaultTzid();
  }
151814
public static String getThreadName(String name){
        if(name==null || name.isEmpty()){
            return SD_THREAD_PREFIX + nextIndex();
        }
        return SD_THREAD_PREFIX + name + "_" + nextIndex();
    }
1267594
def get_all_thread_ids(self):
        
        json = self._get_json(self._url.thread_list())
        return [thread['no'] for page in json for thread in page['threads']]
341176
public User get(int id) {
        Connection conn = null;
        User user = null;
        try {
            conn = ConnectionUtils.getConnection();
            user = userDAO.get(conn,id);
        } catch(SQLException e) {
            logger.error(e.getMessage());
        } finally {
            DbUtils.closeQuietly(conn);
        }
        return user;
    }
377046
public Integer getNextIDSeq(final String id) {
        Validate.notNull(id, "ID cannot be null");
        Integer count = this.idCounts.get(id);
        if (count == null) {
            count = Integer.valueOf(1);
        }
        return count;
    }
1143506
public T get(final long _id)
    {
        return getCache4Id() == null ? null : getCache4Id().get(new Long(_id));
    }
1061530
protected Integer getNextDevice(long threadId) {
        Integer device = null;
        if (!CudaEnvironment.getInstance().getConfiguration().isForcedSingleGPU() && getNumberOfDevices() > 0) {
            // simple round-robin here
            synchronized (this) {
                device = CudaEnvironment.getInstance().getConfiguration().getAvailableDevices().get(devPtr.getAndIncrement());

                // We check only for number of entries here, not their actual values
                if (devPtr.get() >= CudaEnvironment.getInstance().getConfiguration().getAvailableDevices().size())
                    devPtr.set(0);

                val t = Thread.currentThread();
                val n = t.getId() == threadId ? t.getName() : "N/A";

                logger.debug("Mapping thread [{} - {}] to device [{}], out of [{}] devices...", threadId, n, device, CudaEnvironment.getInstance().getConfiguration().getAvailableDevices().size());
            }
        } else {
            device = CudaEnvironment.getInstance().getConfiguration().getAvailableDevices().get(0);
            logger.debug("Single device is forced, mapping to device [{}]", device);
        }

        return device;
    }
1322940
public static Thread getThread(Runnable runnable, String name){
        return doThread(runnable, name, DefaultThreadDeamon);
    }
848578
public Set<String> getDeadlockedThreads() {
    final long[] threadIds = threads.findDeadlockedThreads();
    if (threadIds != null) {
      final Set<String> threads = new HashSet<String>();
      for (ThreadInfo info : this.threads.getThreadInfo(threadIds, MAX_STACK_TRACE_DEPTH)) {
        final StringBuilder stackTrace = new StringBuilder();
        for (StackTraceElement element : info.getStackTrace()) {
          stackTrace.append("\t at ").append(element.toString()).append('\n');
        }

        threads.add(
          String.format(
            "%s locked on %s (owned by %s):\n%s",
            info.getThreadName(), info.getLockName(),
            info.getLockOwnerName(),
            stackTrace.toString()));
      }
      return Collections.unmodifiableSet(threads);
    }
    return Collections.emptySet();
  }
843950
def thread_exists(self, thread_id):
        
        return self._requests_session.head(
            self._url.thread_api_url(
                thread_id=thread_id
                )
        ).ok
1336573
def get_thread_id(self):
        """"""
        if self._id is None:
            for thread_id, obj in list(threading._active.items()):
                if obj is self:
                    self._id = thread_id
        return self._id