Sha256: d01071c5ef68047a9e55b21a05194cd0970ce4801b2c8b3ade5530356bfa7331

Contents?: true

Size: 1.44 KB

Versions: 30

Compression:

Stored size: 1.44 KB

Contents

// Copyright 2000 Samuele Pedroni

package jxxload_help;

import org.python.core.PyJavaClass;

public class DiscardHelp extends Object {

  private DiscardHelp() {
  }

  private static boolean check(Class c,ClassLoader loader,java.util.Vector interfaces) {
    try {
        Class s = c;
        do {
            if (s.getClassLoader() == loader) return true;
            s = s.getSuperclass();
        } while (s != null);
        
        for(java.util.Enumeration enumm=interfaces.elements(); enumm.hasMoreElements();) {
            Class intf = (Class)enumm.nextElement();
            if (intf.isAssignableFrom(c)) return true;
        }
        
    } catch(SecurityException e) {
    }
    return false;
  }

  // clearly not thread safe
  public static void discard(ClassLoader loader,java.util.Vector interfaces) {
    
    org.python.core.InternalTables tbl = PyJavaClass.getInternalTables();
    
    tbl._beginCanonical();
    
    PyJavaClass jc;
    while ((jc = (PyJavaClass)tbl._next()) != null ) {
        Class c = (Class)jc.__tojava__(Class.class);
        if(check(c,loader,interfaces)) tbl._flushCurrent();    
    }
    
    tbl._beginOverAdapterClasses();
    
    Class c;
    
    while ((c = (Class)tbl._next()) != null) {
        if(interfaces.contains(c)) tbl._flushCurrent();
    }
    
    tbl._beginOverAdapters();
    
    while ((c = (Class)tbl._next()) != null) {
        if(interfaces.contains(c)) tbl._flushCurrent();
    }
    
  }

}

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.12.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.11.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.9.2.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.9.1.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.9.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.8.4.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.8.0.1 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.8.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.3.0.0 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java
rubyfox-server-2.3.0.pre2 lib/rubyfox/server/data/lib/Lib/jxxload_help/DiscardHelp.java