Package org.eclipse.m2m.atl.emftvm.util
Class ExecEnvPool
java.lang.Object
org.eclipse.m2m.atl.emftvm.util.ExecEnvPool
Pool of reusable
ExecEnv
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the first availableExecEnv
instance from this pool.protected Queue<SoftReference<ExecEnv>>
Returns the pool of all freeExecEnv
instances.protected ModuleResolverFactory
protected Collection<SoftReference<ExecEnv>>
getPool()
Returns the pool of allExecEnv
instances created by thisExecEnvPool
.boolean
isFrozen()
Returns whether thisExecEnvPool
has been frozen, i.e.void
loadModule
(String name) Loads the module with the givenname
and its imports closure, and registers its contents for execution.void
registerMetaModel
(String name, Metamodel metamodel) Registersmetamodel
undername
.void
returnExecEnv
(ExecEnv env) Returnsenv
to this pool.protected void
setFrozen
(boolean frozen) void
setModuleResolverFactory
(ModuleResolverFactory moduleResolverFactory) Sets theModuleResolverFactory
to use for loading modules.
-
Constructor Details
-
ExecEnvPool
public ExecEnvPool()
-
-
Method Details
-
registerMetaModel
Registersmetamodel
undername
.- Parameters:
name
- the name under which to registermetamodel
- the metamodel to register- Throws:
IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
loadModule
Loads the module with the givenname
and its imports closure, and registers its contents for execution.- Parameters:
name
- the module name- Throws:
IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
getExecEnv
Returns the first availableExecEnv
instance from this pool. Creates a new instance if necessary.- Returns:
- the first available
ExecEnv
instance from this pool
-
returnExecEnv
Returnsenv
to this pool.env
must have been created by this pool.- Parameters:
env
- theExecEnv
to return to this pool- Throws:
IllegalArgumentException
- ifenv
was not created by this pool
-
isFrozen
public boolean isFrozen()Returns whether thisExecEnvPool
has been frozen, i.e. no new metamodels or modules can be loaded.- Returns:
- whether this
ExecEnvPool
has been frozen, i.e. no new metamodels or modules can be loaded
-
setFrozen
protected void setFrozen(boolean frozen) - Parameters:
frozen
- the frozen to set
-
getMetamodels
- Returns:
- the metamodels
-
getModuleResolverFactory
- Returns:
- the moduleResolverFactory
-
setModuleResolverFactory
Sets theModuleResolverFactory
to use for loading modules.- Parameters:
moduleResolverFactory
- the moduleResolverFactory to set- Throws:
IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
getModules
- Returns:
- the modules
-
getPool
Returns the pool of allExecEnv
instances created by thisExecEnvPool
.- Returns:
- the pool
-
getFreePool
- Returns:
- the freePool
-