예제 #1
0
 // Get list of Java threads that have called Object.wait on the specified monitor.
 public List getWaitingThreads(ObjectMonitor monitor) {
   List pendingThreads = new ArrayList();
   for (JavaThread thread = first(); thread != null; thread = thread.next()) {
     ObjectMonitor waiting = thread.getCurrentWaitingMonitor();
     if (monitor.equals(waiting)) {
       pendingThreads.add(thread);
     }
   }
   return pendingThreads;
 }
예제 #2
0
  /**
   * Return a List of SA Fields for the fields declared in this class. Inherited fields are not
   * included. Return an empty list if there are no fields declared in this class. Only designed for
   * use in a debugging system.
   */
  public List getImmediateFields() {
    // A list of Fields for each field declared in this class/interface,
    // not including inherited fields.
    TypeArray fields = getFields();

    int length = (int) fields.getLength();
    List immediateFields = new ArrayList(length / NEXT_OFFSET);
    for (int index = 0; index < length; index += NEXT_OFFSET) {
      immediateFields.add(getFieldByIndex(index));
    }

    return immediateFields;
  }
예제 #3
0
 // refer to Threads::get_pending_threads
 // Get list of Java threads that are waiting to enter the specified monitor.
 public List getPendingThreads(ObjectMonitor monitor) {
   List pendingThreads = new ArrayList();
   for (JavaThread thread = first(); thread != null; thread = thread.next()) {
     if (thread.isCompilerThread() || thread.isCodeCacheSweeperThread()) {
       continue;
     }
     ObjectMonitor pending = thread.getCurrentPendingMonitor();
     if (monitor.equals(pending)) {
       pendingThreads.add(thread);
     }
   }
   return pendingThreads;
 }
예제 #4
0
  /**
   * Return a List containing an SA InstanceKlass for each interface named in this class's
   * 'implements' clause.
   */
  public List getDirectImplementedInterfaces() {
    // Contains an InstanceKlass for each interface in this classes
    // 'implements' clause.

    ObjArray interfaces = getLocalInterfaces();
    int length = (int) interfaces.getLength();
    List directImplementedInterfaces = new ArrayList(length);

    for (int index = 0; index < length; index++) {
      directImplementedInterfaces.add(interfaces.getObjAt(index));
    }

    return directImplementedInterfaces;
  }