Package org.eclipse.m2m.atl.emftvm.util
Class ExecEnvPool
java.lang.Object
org.eclipse.m2m.atl.emftvm.util.ExecEnvPool
Pool of reusable
ExecEnvs.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the first availableExecEnvinstance from this pool.protected Queue<SoftReference<ExecEnv>> Returns the pool of all freeExecEnvinstances.protected ModuleResolverFactoryprotected Collection<SoftReference<ExecEnv>> getPool()Returns the pool of allExecEnvinstances created by thisExecEnvPool.booleanisFrozen()Returns whether thisExecEnvPoolhas been frozen, i.e.voidloadModule(String name) Loads the module with the givennameand its imports closure, and registers its contents for execution.voidregisterMetaModel(String name, Metamodel metamodel) Registersmetamodelundername.voidreturnExecEnv(ExecEnv env) Returnsenvto this pool.protected voidsetFrozen(boolean frozen) voidsetModuleResolverFactory(ModuleResolverFactory moduleResolverFactory) Sets theModuleResolverFactoryto use for loading modules.
-
Constructor Details
-
ExecEnvPool
public ExecEnvPool()
-
-
Method Details
-
registerMetaModel
Registersmetamodelundername.- 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 givennameand 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 availableExecEnvinstance from this pool. Creates a new instance if necessary.- Returns:
- the first available
ExecEnvinstance from this pool
-
returnExecEnv
Returnsenvto this pool.envmust have been created by this pool.- Parameters:
env- theExecEnvto return to this pool- Throws:
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
- Returns:
- the metamodels
-
getModuleResolverFactory
- Returns:
- the moduleResolverFactory
-
setModuleResolverFactory
Sets theModuleResolverFactoryto 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 allExecEnvinstances created by thisExecEnvPool.- Returns:
- the pool
-
getFreePool
- Returns:
- the freePool
-