aicas logoJamaica 6.4 release 1

javax.realtime
Class MemoryParameters

java.lang.Object
  extended by javax.realtime.MemoryParameters
All Implemented Interfaces:
Cloneable

public class MemoryParameters
extends Object
implements Cloneable

Jamaica Real-Time Specification for Java class MemoryParameters.

An instance of MemoryParameters can be associated with a schedulable object to describe and limit the memory allocation characteristics of this schedulable object. If a schedulable object exceeds the limits specified by its MemoryParameters, an OutOfMemoryError will be thrown on the allocation.

A memory parameters object that is shared by several schedulable objects does not mean that all those schedulable object will not exceed the allocation limits of this MemoryParameters object. Instead, the limits apply to each single schedulable object only.

NOTE: the methods in this class are not synchronized. They cannot be used by several threads simultaneously without proper explicit synchronization.


Field Summary
static long NO_MAX
          This value specifies no limit on the allocation budget.
 
Constructor Summary
MemoryParameters(long maxMemoryArea, long maxImmortal)
          Constructor to create a MemoryParameters with given maximum allocation budgets.
MemoryParameters(long maxMemoryArea, long maxImmortal, long allocationRate)
          Constructor to create a MemoryParameters with given maximum allocation budgets.
 
Method Summary
 Object clone()
          clone create a clone of this object with the same parameters but without association to any schedulable object
 long getAllocationRate()
          getAllocationRate returns the current maximum allocation rate in bytes per second.
 long getMaxImmortal()
          getMaxImmortal returns the current limit on the allocation allowed in the immortal memory area.
 long getMaxMemoryArea()
          getMaxMemoryArea returns the limit on the allocation allowed in the initial memory area.
 void setAllocationRate(long allocationRate)
          setAllocationRate sets the current maximum allocation rate in bytes per second.
 boolean setAllocationRateIfFeasible(long allocationRate)
          setAllocationRateIfFeasible first checks if the schedulables associated with this would still be feasible with the new allocation rate.
 boolean setMaxImmortalIfFeasible(long maximum)
          setMaxImmortalIfFeasible first checks if the schedulables associated with this would still be feasible with the new immortal allocation limit.
 boolean setMaxMemoryAreaIfFeasible(long maximum)
          setMaxMemoryAreaIfFeasible first checks if the schedulables associated with this would still be feasible with the new allocation limit.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_MAX

public static final long NO_MAX
This value specifies no limit on the allocation budget.

See Also:
Constant Field Values
Constructor Detail

MemoryParameters

public MemoryParameters(long maxMemoryArea,
                        long maxImmortal)
                 throws IllegalArgumentException
Constructor to create a MemoryParameters with given maximum allocation budgets.

Parameters:
maxMemoryArea - The limit on the allocation allowed in the initial memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
maxImmortal - The limit on the allocation allowed in the immortal memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
Throws:
IllegalArgumentException - if maxMemoryArea or maxImmortal is negative and not NO_MAX.

MemoryParameters

public MemoryParameters(long maxMemoryArea,
                        long maxImmortal,
                        long allocationRate)
                 throws IllegalArgumentException
Constructor to create a MemoryParameters with given maximum allocation budgets.

Parameters:
maxMemoryArea - The limit on the allocation allowed in the initial memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
maxImmortal - The limit on the allocation allowed in the immortal memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
allocationRate - the maximum allocation rate in bytes per second allowed on the heap. zero means no allocation is allowed on the heap, NO_MAX means no limit on the allocation rate. Measurement starts when the schedulable object is first released. Enforcement of the allocation rate is an implementation option and is not implemented for JamaicaVM. The garbage collector of JamaicaVM is not paced, so it is not required to restrict the allocation rate of the application to work properly.
Throws:
IllegalArgumentException - if maxMemoryArea, maxImmortal or allocationRate is negative and not NO_MAX.
Method Detail

getAllocationRate

public long getAllocationRate()
getAllocationRate returns the current maximum allocation rate in bytes per second.

Returns:
the current allocation rate.

getMaxImmortal

public long getMaxImmortal()
getMaxImmortal returns the current limit on the allocation allowed in the immortal memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.

Returns:
the current limit on immortal memory.

getMaxMemoryArea

public long getMaxMemoryArea()
getMaxMemoryArea returns the limit on the allocation allowed in the initial memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.

Returns:
the current limit on allocation in initial memory area.

setAllocationRate

public void setAllocationRate(long allocationRate)
setAllocationRate sets the current maximum allocation rate in bytes per second.

Parameters:
allocationRate - the maximum allocation rate in bytes per second allowed on the heap. zero means no allocation is allowed on the heap, NO_MAX means no limit on the allocation rate. Measurement starts when the schedulable object is first released. Enforcement of the allocation rate is an implementation option and is not implemented for JamaicaVM. The garbage collector of JamaicaVM is not paced, so it is not required to restrict the allocation rate of the application to work properly.
Throws:
IllegalArgumentException - if allocationRate is negative and not NO_MAX.

setMaxImmortalIfFeasible

public boolean setMaxImmortalIfFeasible(long maximum)
setMaxImmortalIfFeasible first checks if the schedulables associated with this would still be feasible with the new immortal allocation limit. If so, it sets the current maximum allocation limit.

Parameters:
maximum - The limit on the allocation allowed in the immortal memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
Returns:
true if the change was made, false if it was not made since the change was not feasible or any of the affected schedulables has already exceeded the new allocation limit.
Throws:
IllegalArgumentException - if maximum is negative and not NO_MAX.

setMaxMemoryAreaIfFeasible

public boolean setMaxMemoryAreaIfFeasible(long maximum)
setMaxMemoryAreaIfFeasible first checks if the schedulables associated with this would still be feasible with the new allocation limit. If so, it sets the current maximum allocation limit.

Parameters:
maximum - The limit on the allocation allowed in the initial memory area. zero implies that no allocation is allowed, NO_MAX does not restrict the amount of allocation.
Returns:
true if the change was made, false if it was not made since the change was not feasible or any of the affected schedulables has already exceeded the new allocation limit.
Throws:
IllegalArgumentException - if maximum is negative and not NO_MAX.

setAllocationRateIfFeasible

public boolean setAllocationRateIfFeasible(long allocationRate)
setAllocationRateIfFeasible first checks if the schedulables associated with this would still be feasible with the new allocation rate. If so, it sets the current maximum allocation rate in bytes per second.

Parameters:
allocationRate - the maximum allocation rate in bytes per second allowed on the heap. zero means no allocation is allowed on the heap, NO_MAX means no limit on the allocation rate. Measurement starts when the schedulable object is first released. Enforcement of the allocation rate is an implementation option and it is not implemented for JamaicaVM. The garbage collector of JamaicaVM is not paced, so it is not required to restrict the allocation rate of the application to work properly.
Returns:
true if the change was made
Throws:
IllegalArgumentException - if allocationRate is negative and not NO_MAX.

clone

public Object clone()
clone create a clone of this object with the same parameters but without association to any schedulable object

Overrides:
clone in class Object
Returns:
a new instance of MemoryParameters with equal maxMemoryArea, maxImmortal, and allocationRate arguments.
Since:
RTSJ V1.0.1

aicas logoJamaica 6.4 release 1

aicas GmbH, Karlsruhe, Germany —www.aicas.com
Copyright © 2001-2015 aicas GmbH. All Rights Reserved.