Interface Environment
- All Superinterfaces:
Attributes
A named runtime environment containing a
ClassLoader
and Attributes
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.util.Attributes
Attributes.Layer, Attributes.Lazy, Attributes.Mapped, Attributes.Synthetic, Attributes.Wrapper
-
Field Summary
FieldsFields inherited from interface org.eclipse.jetty.util.Attributes
NULL
-
Method Summary
Modifier and TypeMethodDescriptionstatic Environment
create
(String name, ClassLoader classLoader) Creates an environment with the given name and classloader.static Environment
Gets the environment with the given name, creating it with the default classloader if necessary.static Environment
Gets the environment with the given name.static Collection
<Environment> getAll()
Gets all existing environments.getName()
static void
Removes all the environments.default void
Run aRunnable
in the environment, i.e. with currentThread.getContextClassLoader()
set togetClassLoader()
.Methods inherited from interface org.eclipse.jetty.util.Attributes
asAttributeMap, clearAttributes, equals, getAttribute, getAttributeNameSet, hashCode, removeAttribute, setAttribute
-
Field Details
-
LOG
static final org.slf4j.Logger LOG
-
-
Method Details
-
getAll
-
removeAll
static void removeAll()Removes all the environments. -
get
Gets the environment with the given name.- Parameters:
name
- the environment name- Returns:
- the environment, or null if no environment with such name exists
-
ensure
Gets the environment with the given name, creating it with the default classloader if necessary.- Parameters:
name
- the environment nameclassToLoad
- A class to either: use to create the environment with its classloader; or to check the environments can load the passed class.- Returns:
- the environment
- Throws:
IllegalArgumentException
- if an environment with the given name but a different classloader already existsIllegalStateException
-
create
Creates an environment with the given name and classloader.- Parameters:
name
- the environment nameclassLoader
- the environment classloader- Returns:
- the environment
- Throws:
IllegalStateException
- if an environment with the given name already exists
-
getName
String getName()- Returns:
- The case-insensitive name of the environment.
-
getClassLoader
ClassLoader getClassLoader()- Returns:
- The
ClassLoader
for the environment or if none set, then theClassLoader
that loaded the environment implementation.
-
run
Run aRunnable
in the environment, i.e. with currentThread.getContextClassLoader()
set togetClassLoader()
.- Parameters:
runnable
- TheRunnable
to run in the environment.
-