Package ej.kf
Class Module
- java.lang.Object
-
- ej.kf.Module
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetAllocatedMemory()Returns the amount of allocated memory by this module.longgetExecutionCounter()Gets the current execution counter, since the last reset.intgetExecutionQuota()Gets the execution quota.StringgetName()Gets the name of this module.PrincipalgetProvider()Gets the identification of this module provider.byte[]getUID()Gets a byte sequence that uniquely identifies the current module.StringgetVersion()Gets aStringthat represents this module version.voidsetExecutionQuota(int quota)Sets the execution quota allocated to the threads owned by thisModule.
-
-
-
Method Detail
-
getName
public String getName()
Gets the name of this module.- Returns:
- the internal name
-
getProvider
public Principal getProvider()
Gets the identification of this module provider.- Returns:
- the module identification.
-
getVersion
public String getVersion()
Gets aStringthat represents this module version.- Returns:
- the module version
-
getUID
public byte[] getUID()
Gets a byte sequence that uniquely identifies the current module.- Returns:
- this module UID
-
setExecutionQuota
public void setExecutionQuota(int quota)
Sets the execution quota allocated to the threads owned by thisModule. This quota is expressed in execution units.A Thread owned by a
Modulewhich execution quota set to0will never be scheduled.A Thread owned by a
Modulewhich execution quota set to-1is always eligible to scheduling.Calling this method induces a global reset of the quantum of all the Modules.
A
Moduleis created with an execution quota set to-1. When the quota of allModuleis set to-1, the execution counting is disabled. When the quota of aModuleis set to a value other than-1, the execution counting is enabled.- Parameters:
quota- the execution quota to set to thisModulein execution units- Throws:
IllegalArgumentException- if the given quota is lower than-1.
-
getExecutionQuota
public int getExecutionQuota()
Gets the execution quota.- Returns:
- the quota of this
Modulein execution units.
-
getExecutionCounter
public long getExecutionCounter()
Gets the current execution counter, since the last reset. The execution counters are reset each timesetExecutionQuota(int)is called on aModule.- Returns:
- the total amount of execution units that has been consumed by threads owned by this
Module, or0if execution counting is disabled.
-
getAllocatedMemory
public long getAllocatedMemory()
Returns the amount of allocated memory by this module.To get an accurate value of the allocated memory, run the garbage collector
Runtime.gc()orSystem.gc()before calling this method.- Returns:
- the amount of allocated memory by this module, measured in bytes.
-
-