站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jmx API Documentation 英文版文档

UnifiedClassLoader4 (JBoss/JMX API) - JBoss 3.2.7 jmx API Documentation 英文版文档


org.jboss.mx.loading
Class UnifiedClassLoader4

java.lang.Object
  extended byjava.lang.ClassLoader
      extended byjava.security.SecureClassLoader
          extended byjava.net.URLClassLoader
              extended byorg.jboss.mx.loading.UnifiedClassLoader
                  extended byorg.jboss.mx.loading.UnifiedClassLoader4
All Implemented Interfaces:
org.jboss.util.loading.Translatable, UnifiedClassLoader3MBean, UnifiedClassLoaderMBean

public class UnifiedClassLoader4
extends UnifiedClassLoader
implements UnifiedClassLoader3MBean

An extension of UnifiedClassLoader that manages a thread based loading strategy to work around the locking problems associated with the VM initiated locking due to the synchronized loadClassInternal method of ClassLoader which cannot be overriden.

Version:
$Revision: 1.1.2.2 $
Author:
Scott Stark

Field Summary
protected  EDU.oswego.cs.dl.util.concurrent.ReentrantLock loadLock
           
 
Fields inherited from class org.jboss.mx.loading.UnifiedClassLoader
origURL, repository, unregisterTrace, url
 
Constructor Summary
UnifiedClassLoader4(URL url)
          Construct a UnifiedClassLoader without registering it to the classloader repository.
UnifiedClassLoader4(URL url, URL origURL)
          Construct a UnifiedClassLoader without registering it to the classloader repository.
UnifiedClassLoader4(URL url, URL origURL, ClassLoader parent, LoaderRepository repository)
          Construct a UnifiedClassLoader and associate it with the given repository.
UnifiedClassLoader4(URL url, URL origURL, LoaderRepository repository)
          Construct a UnifiedClassLoader and associate it with the given repository.
 
Method Summary
protected  void acquire()
          Acquire the class loading lock.
protected  boolean attempt(long waitMS)
          Attempt to acquire the class loading lock.
 int getAddedOrder()
           
 URL getResource(String name)
          Load the resource from the repository using the LoadMgr as the synchronization point.
 Class loadClass(String name, boolean resolve)
          Called to load a class into the repository.
protected  void release()
          Release the class loading lock previous acquired through the acquire method.
 void setAddedOrder(int addedOrder)
           
 String toString()
          Retruns a string representaion of this UCL.
 void unregister()
           
 
Methods inherited from class org.jboss.mx.loading.UnifiedClassLoader
addURL, clearBlacklists, definePackage, equals, findClass, findResources, findResourcesLocally, getAllURLs, getClasspath, getLoaderRepository, getObjectName, getOrigURL, getPackage, getPackages, getPermissions, getProtectionDomain, getProtectionDomain, getResourceLocally, getURL, getURLs, hashCode, loadByteCode, loadClassLocally, setRepository
 
Methods inherited from class java.net.URLClassLoader
definePackage, findResource, newInstance, newInstance
 
Methods inherited from class java.security.SecureClassLoader
defineClass
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getParent, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

loadLock

protected EDU.oswego.cs.dl.util.concurrent.ReentrantLock loadLock
Constructor Detail

UnifiedClassLoader4

public UnifiedClassLoader4(URL url)
Construct a UnifiedClassLoader without registering it to the classloader repository.

Parameters:
url - the single URL to load classes from.

UnifiedClassLoader4

public UnifiedClassLoader4(URL url,
                           URL origURL)
Construct a UnifiedClassLoader without registering it to the classloader repository.

Parameters:
url - the single URL to load classes from.
origURL - the possibly null original URL from which url may be a local copy or nested jar.

UnifiedClassLoader4

public UnifiedClassLoader4(URL url,
                           URL origURL,
                           LoaderRepository repository)
Construct a UnifiedClassLoader and associate it with the given repository.

Parameters:
url - The single URL to load classes from.
origURL - the possibly null original URL from which url may be a local copy or nested jar.
repository - the repository this classloader delegates to

UnifiedClassLoader4

public UnifiedClassLoader4(URL url,
                           URL origURL,
                           ClassLoader parent,
                           LoaderRepository repository)
Construct a UnifiedClassLoader and associate it with the given repository.

Parameters:
url - The single URL to load classes from.
origURL - the possibly null original URL from which url may be a local copy or nested jar.
parent - the parent class loader to use
repository - the repository this classloader delegates to
Method Detail

unregister

public void unregister()
Overrides:
unregister in class UnifiedClassLoader

getAddedOrder

public int getAddedOrder()
Overrides:
getAddedOrder in class UnifiedClassLoader

setAddedOrder

public void setAddedOrder(int addedOrder)
Overrides:
setAddedOrder in class UnifiedClassLoader

toString

public String toString()
Retruns a string representaion of this UCL.

Overrides:
toString in class UnifiedClassLoader

loadClass

public Class loadClass(String name,
                       boolean resolve)
                throws ClassNotFoundException
Called to load a class into the repository. The calling thread owns the UCL monitor and handles class loadings tasks for which this UCL is likely to be able to handle based on the pkg to URL mapping in the repository.

Overrides:
loadClass in class UnifiedClassLoader
Throws:
ClassNotFoundException

getResource

public URL getResource(String name)
Load the resource from the repository using the LoadMgr as the synchronization point.

Overrides:
getResource in class UnifiedClassLoader

attempt

protected boolean attempt(long waitMS)
Attempt to acquire the class loading lock. This lock must be acquired before a thread enters the class loading task loop in loadClass. This method maintains any interrupted state of the calling thread.

See Also:
loadClass(String, boolean)

acquire

protected void acquire()
Acquire the class loading lock. This lock must be acquired before a thread enters the class loading task loop in loadClass.

See Also:
loadClass(String, boolean)

release

protected void release()
Release the class loading lock previous acquired through the acquire method.



Copyright © 2002 JBoss Group, LLC. All Rights Reserved.