Code example for URLClassLoader

0
    private final long timestamp; 
 
    public CachedClassLoader(URL url) { 
	this.url = url; 
	URL[] urls = new URL[] { url }; 
	this.classloader = new URLClassLoader(urls); 
	this.timestamp = System.currentTimeMillis(); 
    } 
 
    public ClassLoader getClassLoader() { 
	return this.classloader; 
    } 
 
    public boolean isExpired() { 
	File file = new File(this.url.getFile()); 
	if (file.isFile() && file.lastModified() > timestamp) { 
	    return true; 
	} else { 
	    return isExpiredByDirectory(file); 
	} 
    }