org.clazzes.remoting.loading
Class RemotingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.clazzes.remoting.loading.RemotingClassLoader
All Implemented Interfaces:
Destroyable

public class RemotingClassLoader
extends java.lang.ClassLoader
implements Destroyable

This class loader allows to dynamically load classes from a remote server. This implementation does not take care for retrieving the compiled class via ClassLoader.getResourceAsStream(String) by fetching the resource with the extension .class. This means that classes, which have been loaded from a remote server can not be forwarded to another server again, because ClassHelper.getCompiledClass(String, ClassLoader) works by fetching the associated .class resource. Implementing ClassLoader.getResourceAsStream(String) causes major headaches and passing a remotely loaded class to another server seems to be a risk anyways.


Constructor Summary
RemotingClassLoader(java.lang.ClassLoader parent, RemoteInvoker client)
           
 
Method Summary
 void destroy()
          Cleanup internal resources.
protected  java.lang.Class<?> findClass(java.lang.String name)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemotingClassLoader

public RemotingClassLoader(java.lang.ClassLoader parent,
                           RemoteInvoker client)
Parameters:
parent - The parent class loader.
client - The client used to load remote classes.
Method Detail

findClass

protected java.lang.Class<?> findClass(java.lang.String name)
                                throws java.lang.ClassNotFoundException
Overrides:
findClass in class java.lang.ClassLoader
Throws:
java.lang.ClassNotFoundException

destroy

public void destroy()
Description copied from interface: Destroyable
Cleanup internal resources. An implementation must be safe to be called twice. Any error should be logged rather than thrown as exceptions. If this bean implements Initializable too, the general contract is, that after calling this method, Initializable.isInitialized() returns false.

Specified by:
destroy in interface Destroyable


Copyright © 2010. All Rights Reserved.