KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mx > loading > UnifiedClassLoader3


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.mx.loading;
23
24 import java.net.URL JavaDoc;
25
26 /** An extension of UnifiedClassLoader that manages a thread based loading
27  * strategy to work around the locking problems associated with the VM
28  * initiated locking due to the synchronized loadClassInternal method of
29  * ClassLoader which cannot be overriden.
30
31  * @author <a HREF="scott.stark@jboss.org">Scott Stark</a>
32  * @version $Revision: 37459 $
33 */

34 public class UnifiedClassLoader3 extends UnifiedClassLoader
35    implements UnifiedClassLoader3MBean
36 {
37    // Static --------------------------------------------------------
38

39    // Attributes ----------------------------------------------------
40

41    // Constructors --------------------------------------------------
42
/**
43     * Construct a <tt>UnifiedClassLoader</tt> without registering it to the
44     * classloader repository.
45     *
46     * @param url the single URL to load classes from.
47     */

48    public UnifiedClassLoader3(URL JavaDoc url)
49    {
50       this(url, null);
51    }
52    /**
53     * Construct a <tt>UnifiedClassLoader</tt> without registering it to the
54     * classloader repository.
55     *
56     * @param url the single URL to load classes from.
57     * @param origURL the possibly null original URL from which url may
58     * be a local copy or nested jar.
59     */

60    public UnifiedClassLoader3(URL JavaDoc url, URL JavaDoc origURL)
61    {
62       super(url, origURL);
63    }
64
65    /** Construct a UnifiedClassLoader and associate it with the given
66     * repository.
67     * @param url The single URL to load classes from.
68     * @param origURL the possibly null original URL from which url may
69     * be a local copy or nested jar.
70     * @param repository the repository this classloader delegates to
71     */

72    public UnifiedClassLoader3(URL JavaDoc url, URL JavaDoc origURL, LoaderRepository repository)
73    {
74       this(url, origURL);
75
76       // set the repository reference
77
this.setRepository(repository);
78    }
79    /** Construct a UnifiedClassLoader and associate it with the given
80     * repository.
81     * @param url The single URL to load classes from.
82     * @param origURL the possibly null original URL from which url may
83     * be a local copy or nested jar.
84     * @param parent the parent class loader to use
85     * @param repository the repository this classloader delegates to
86     */

87    public UnifiedClassLoader3(URL JavaDoc url, URL JavaDoc origURL, ClassLoader JavaDoc parent,
88          LoaderRepository repository)
89    {
90       super(url, origURL, parent);
91
92       // set the repository reference
93
this.setRepository(repository);
94    }
95
96    // Public --------------------------------------------------------
97

98    /**
99    * Retruns a string representaion of this UCL.
100    */

101    public String JavaDoc toString()
102    {
103       StringBuffer JavaDoc tmp = new StringBuffer JavaDoc(super.toString());
104       tmp.setCharAt(tmp.length()-1, ',');
105       tmp.append("addedOrder=");
106       tmp.append(getAddedOrder());
107       tmp.append('}');
108       return tmp.toString();
109    }
110 }
111
Popular Tags