Package org.eclipse.m2m.atl.emftvm.util
Class ExecEnvPool
- java.lang.Object
-
- org.eclipse.m2m.atl.emftvm.util.ExecEnvPool
-
public class ExecEnvPool extends java.lang.Object
Pool of reusableExecEnv
s.
-
-
Constructor Summary
Constructors Constructor Description ExecEnvPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecEnv
getExecEnv()
Returns the first availableExecEnv
instance from this pool.protected java.util.Queue<java.lang.ref.SoftReference<ExecEnv>>
getFreePool()
Returns the pool of all freeExecEnv
instances.protected java.util.Map<java.lang.String,Metamodel>
getMetamodels()
protected ModuleResolverFactory
getModuleResolverFactory()
protected java.util.List<java.lang.String>
getModules()
protected java.util.Collection<java.lang.ref.SoftReference<ExecEnv>>
getPool()
Returns the pool of allExecEnv
instances created by thisExecEnvPool
.boolean
isFrozen()
Returns whether thisExecEnvPool
has been frozen, i.e.void
loadModule(java.lang.String name)
Loads the module with the givenname
and its imports closure, and registers its contents for execution.void
registerMetaModel(java.lang.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.
-
-
-
Method Detail
-
registerMetaModel
public void registerMetaModel(java.lang.String name, Metamodel metamodel)
Registersmetamodel
undername
.- Parameters:
name
- the name under which to registermetamodel
- the metamodel to register- Throws:
java.lang.IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
loadModule
public void loadModule(java.lang.String name)
Loads the module with the givenname
and its imports closure, and registers its contents for execution.- Parameters:
name
- the module name- Throws:
java.lang.IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
getExecEnv
public ExecEnv 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
public void returnExecEnv(ExecEnv env)
Returnsenv
to this pool.env
must have been created by this pool.- Parameters:
env
- theExecEnv
to return to this pool- Throws:
java.lang.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
protected java.util.Map<java.lang.String,Metamodel> getMetamodels()
- Returns:
- the metamodels
-
getModuleResolverFactory
protected ModuleResolverFactory getModuleResolverFactory()
- Returns:
- the moduleResolverFactory
-
setModuleResolverFactory
public void setModuleResolverFactory(ModuleResolverFactory moduleResolverFactory)
Sets theModuleResolverFactory
to use for loading modules.- Parameters:
moduleResolverFactory
- the moduleResolverFactory to set- Throws:
java.lang.IllegalStateException
- ifgetExecEnv()
has already been called on this pool
-
getModules
protected java.util.List<java.lang.String> getModules()
- Returns:
- the modules
-
getPool
protected java.util.Collection<java.lang.ref.SoftReference<ExecEnv>> getPool()
Returns the pool of allExecEnv
instances created by thisExecEnvPool
.- Returns:
- the pool
-
getFreePool
protected java.util.Queue<java.lang.ref.SoftReference<ExecEnv>> getFreePool()
- Returns:
- the freePool
-
-