1330 |
01 Apr 11 |
nicklas |
1 |
/** |
1330 |
01 Apr 11 |
nicklas |
$Id$ |
1330 |
01 Apr 11 |
nicklas |
3 |
|
1330 |
01 Apr 11 |
nicklas |
Copyright (C) 2011 Nicklas Nordborg |
1330 |
01 Apr 11 |
nicklas |
5 |
|
1330 |
01 Apr 11 |
nicklas |
This file is part of BASE - BioArray Software Environment. |
1330 |
01 Apr 11 |
nicklas |
Available at http://base.thep.lu.se/ |
1330 |
01 Apr 11 |
nicklas |
8 |
|
1330 |
01 Apr 11 |
nicklas |
BASE is free software; you can redistribute it and/or |
1330 |
01 Apr 11 |
nicklas |
modify it under the terms of the GNU General Public License |
1330 |
01 Apr 11 |
nicklas |
as published by the Free Software Foundation; either version 3 |
1330 |
01 Apr 11 |
nicklas |
of the License, or (at your option) any later version. |
1330 |
01 Apr 11 |
nicklas |
13 |
|
1330 |
01 Apr 11 |
nicklas |
BASE is distributed in the hope that it will be useful, |
1330 |
01 Apr 11 |
nicklas |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
1330 |
01 Apr 11 |
nicklas |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1330 |
01 Apr 11 |
nicklas |
GNU General Public License for more details. |
1330 |
01 Apr 11 |
nicklas |
18 |
|
1330 |
01 Apr 11 |
nicklas |
You should have received a copy of the GNU General Public License |
1330 |
01 Apr 11 |
nicklas |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
1330 |
01 Apr 11 |
nicklas |
21 |
*/ |
1330 |
01 Apr 11 |
nicklas |
22 |
package net.sf.basedb.hdfs; |
1330 |
01 Apr 11 |
nicklas |
23 |
|
1330 |
01 Apr 11 |
nicklas |
24 |
/** |
1330 |
01 Apr 11 |
nicklas |
Global constants for the Hdfs package. |
1330 |
01 Apr 11 |
nicklas |
@author Nicklas |
1330 |
01 Apr 11 |
nicklas |
@since 1.0 |
1330 |
01 Apr 11 |
nicklas |
28 |
*/ |
1330 |
01 Apr 11 |
nicklas |
29 |
public class Hdfs |
1330 |
01 Apr 11 |
nicklas |
30 |
{ |
1330 |
01 Apr 11 |
nicklas |
31 |
/** |
1330 |
01 Apr 11 |
nicklas |
The current version of this package. |
1330 |
01 Apr 11 |
nicklas |
33 |
*/ |
1453 |
03 Nov 11 |
nicklas |
34 |
public static final String VERSION = "1.1-dev"; |
1330 |
01 Apr 11 |
nicklas |
35 |
|
1330 |
01 Apr 11 |
nicklas |
36 |
/** |
1330 |
01 Apr 11 |
nicklas |
Set the currents thread's context class loader to the |
1330 |
01 Apr 11 |
nicklas |
class loader that loaded this class. The class loader that |
1330 |
01 Apr 11 |
nicklas |
is currently the context class loader is returned and can be |
1330 |
01 Apr 11 |
nicklas |
restored by calling {@link #resetContextClassLoader(ClassLoader)}. |
1330 |
01 Apr 11 |
nicklas |
<p> |
1330 |
01 Apr 11 |
nicklas |
42 |
|
1330 |
01 Apr 11 |
nicklas |
NOTE! Calls to this method must be paired with calls to |
1330 |
01 Apr 11 |
nicklas |
{@link #resetContextClassLoader()} or class loading schemes |
1330 |
01 Apr 11 |
nicklas |
may be messed up. |
1330 |
01 Apr 11 |
nicklas |
@return The old class loader that was the context class loader |
1330 |
01 Apr 11 |
nicklas |
47 |
*/ |
1330 |
01 Apr 11 |
nicklas |
48 |
public static final ClassLoader setContextClassLoader() |
1330 |
01 Apr 11 |
nicklas |
49 |
{ |
1330 |
01 Apr 11 |
nicklas |
50 |
Thread current = Thread.currentThread(); |
1330 |
01 Apr 11 |
nicklas |
51 |
ClassLoader old = current.getContextClassLoader(); |
1330 |
01 Apr 11 |
nicklas |
52 |
current.setContextClassLoader(Hdfs.class.getClassLoader()); |
1330 |
01 Apr 11 |
nicklas |
53 |
return old; |
1330 |
01 Apr 11 |
nicklas |
54 |
} |
1330 |
01 Apr 11 |
nicklas |
55 |
|
1330 |
01 Apr 11 |
nicklas |
56 |
/** |
1330 |
01 Apr 11 |
nicklas |
Reset the currents thread's context class loader to |
1330 |
01 Apr 11 |
nicklas |
the class loader that was stored when {@link #setContextClassLoader()} |
1330 |
01 Apr 11 |
nicklas |
was called. |
1330 |
01 Apr 11 |
nicklas |
<p> |
1330 |
01 Apr 11 |
nicklas |
61 |
|
1330 |
01 Apr 11 |
nicklas |
NOTE! Calls to this method must be paired with calls to |
1330 |
01 Apr 11 |
nicklas |
{@link #setContextClassLoader()} or class loading schemes |
1330 |
01 Apr 11 |
nicklas |
may be messed up. |
1330 |
01 Apr 11 |
nicklas |
65 |
*/ |
1330 |
01 Apr 11 |
nicklas |
66 |
public static final void resetContextClassLoader(ClassLoader old) |
1330 |
01 Apr 11 |
nicklas |
67 |
{ |
1330 |
01 Apr 11 |
nicklas |
68 |
Thread.currentThread().setContextClassLoader(old); |
1330 |
01 Apr 11 |
nicklas |
69 |
} |
1330 |
01 Apr 11 |
nicklas |
70 |
|
1330 |
01 Apr 11 |
nicklas |
71 |
} |