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.ObjectPool of reusableExecEnvs.
-
-
Constructor Summary
Constructors Constructor Description ExecEnvPool()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ExecEnvgetExecEnv()Returns the first availableExecEnvinstance from this pool.protected java.util.Queue<java.lang.ref.SoftReference<ExecEnv>>getFreePool()Returns the pool of all freeExecEnvinstances.protected java.util.Map<java.lang.String,Metamodel>getMetamodels()protected ModuleResolverFactorygetModuleResolverFactory()protected java.util.List<java.lang.String>getModules()protected java.util.Collection<java.lang.ref.SoftReference<ExecEnv>>getPool()Returns the pool of allExecEnvinstances created by thisExecEnvPool.booleanisFrozen()Returns whether thisExecEnvPoolhas been frozen, i.e.voidloadModule(java.lang.String name)Loads the module with the givennameand its imports closure, and registers its contents for execution.voidregisterMetaModel(java.lang.String name, Metamodel metamodel)Registersmetamodelundername.voidreturnExecEnv(ExecEnv env)Returnsenvto this pool.protected voidsetFrozen(boolean frozen)voidsetModuleResolverFactory(ModuleResolverFactory moduleResolverFactory)Sets theModuleResolverFactoryto use for loading modules.
-
-
-
Method Detail
-
registerMetaModel
public void registerMetaModel(java.lang.String name, Metamodel metamodel)Registersmetamodelundername.- 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 givennameand 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 availableExecEnvinstance from this pool. Creates a new instance if necessary.- Returns:
- the first available
ExecEnvinstance from this pool
-
returnExecEnv
public void returnExecEnv(ExecEnv env)
Returnsenvto this pool.envmust have been created by this pool.- Parameters:
env- theExecEnvto return to this pool- Throws:
java.lang.IllegalArgumentException- ifenvwas not created by this pool
-
isFrozen
public boolean isFrozen()
Returns whether thisExecEnvPoolhas been frozen, i.e. no new metamodels or modules can be loaded.- Returns:
- whether this
ExecEnvPoolhas 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 theModuleResolverFactoryto 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 allExecEnvinstances created by thisExecEnvPool.- Returns:
- the pool
-
getFreePool
protected java.util.Queue<java.lang.ref.SoftReference<ExecEnv>> getFreePool()
- Returns:
- the freePool
-
-