public abstract class ExplicitMemory extends MemoryArea
| Modifier and Type | Method and Description |
|---|---|
static int |
countExplicitMemories()
Returns the number of Explicit memory blocks in the Explicit heap.
|
long |
freeMemory()
Returns the memory size that can be used by Explicit memory blocks.
|
static java.lang.management.MemoryUsage |
getMemoryUsage()
Returns the usage state of the Explicit heap.
|
boolean |
isActive()
Returns whether or not the Explicit memory block indicated by the object can be processed.
|
boolean |
isReclaimed()
Returns whether or not the Explicit memory block indicated by the object is in the reserved for release state or the released state.
|
java.lang.Object |
newArray(java.lang.Class type,
int length)
Directly creates an array instance of the length specified in the parameter length of the class that is specified in the parameter type of the Explicit memory block indicated by the object.
|
java.lang.Object |
newArray(java.lang.Class type,
int[] dimensions)
Directly creates an array instance with a dimension dimensions.length in the Explicit memory block indicated by the object.
|
java.lang.Object |
newInstance(java.lang.Class type)
Directly creates the instances of the class indicated by the parameter type in the Explicit memory block indicated by the object.
|
java.lang.Object |
newInstance(java.lang.Class type,
java.lang.Object... args)
Directly creates the instances of the class indicated by the parameter type in the Explicit memory block.
|
java.lang.Object |
newInstance(java.lang.reflect.Constructor cons,
java.lang.Object... args)
Executes the constructor indicated by the parameter cons in the parameter args, and then directly creates the instance in the Explicit memory block indicated by the object.
|
static void |
reclaim(ExplicitMemory... areas)
Reserves the release processing for all the elements of the parameter areas.
|
static void |
reclaim(ExplicitMemory area)
If it is judged by the common error check that the processing can be executed when the parameter area is other than null, execute the exclusion processing in the parameter area, and then reserve the Explicit memory block indicated by the parameter area for the release.
|
static void |
reclaim(ExplicitMemory area0,
ExplicitMemory area1)
Reserves the release processing for the Explicit memory blocks indicated by the parameter area0 and area1.
|
static void |
reclaim(java.lang.Iterable<ExplicitMemory> areas)
Reserves the release processing for all the elements of the parameter areas.
|
void |
setName(java.lang.String name)
Sets up a name for the Explicit memory block.
|
java.lang.String |
toString()
Returns the string expression of the object.
|
long |
totalMemory()
Returns the total reserved size of the Explicit memory block.
|
long |
usedMemory()
Returns the used memory size of the Explicit memory block.
|
getNamepublic void setName(java.lang.String name)
throws java.lang.NullPointerException
Note: The names are not unique because the same name can be set up in multiple ExplicitMemory.
setName in class MemoryAreaname - This parameter specifies the string that indicates the name to be set up.java.lang.NullPointerException - The value of the parameter name is null.public boolean isActive()
true:The Explicit memory block can be processed. This value is returned for an enabled Explicit memory block, when the substate is Enable. false:The Explicit memory block cannot be processed. This value is returned in either of the following cases.
Note: Once the ExplicitMemory is disabled, it cannot be enabled again.
public java.lang.Object newInstance(java.lang.Class type)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException,
java.lang.SecurityException,
InaccessibleMemoryAreaException,
java.lang.ExceptionInInitializerError,
java.lang.NullPointerException
newInstance in class MemoryAreatype - This is the class of the array instance to be created directly.Common Error Check.java.lang.NullPointerException - Either the parameter type or the class indicated by the parameter type is null.java.lang.SecurityException - This exception is thrown when SecurityManager exists, and when any of the following conditions hold true.
java.lang.NoSuchMethodException - No constructor, without a public parameter, exists in either the parameter type or the class indicated by the parameter type.java.lang.ExceptionInInitializerError - An attempt to initialize the parameter type or the class indicated by the parameter type has failed.java.lang.InstantiationException - The parameter type or the class indicated by the parameter type is either an abstract class or an interface.java.lang.reflect.InvocationTargetException - An exception occurred during the execution of the parameter type or the constructor of the class indicated by the parameter type.java.lang.IllegalAccessException - The class or its nullary constructor cannot be accessed.InaccessibleMemoryAreaException - This functionality is not supported.public java.lang.Object newInstance(java.lang.Class type,
java.lang.Object... args)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException,
java.lang.NoSuchMethodException,
java.lang.SecurityException,
InaccessibleMemoryAreaException,
java.lang.ExceptionInInitializerError,
java.lang.NullPointerException
Note:
We recommend that you add a public class in the parameter type.
You cannot invoke a constructor in which the primitive type is assumed as an argument.
To invoke a constructor in which the primitive type is assumed as an argument, use the newInstance(Constructor, Object...).
A coding example in which the newInstance newInstance(Constructor, Object...) is used is as follows.
import JP.co.Hitachi.soft.jvm.MemoryArea.*;
import java.lang.reflect.*;
public class test1 {
public static void main(String[] args) throws Exception {
ExplicitMemory em = new BasicExplicitMemory();
TheClass obj = null;
Constructor cons = TheClass.class.getConstructor(
new Class[]{int.class}
);
// Execution successful
obj = (TheClass)em.newInstance(cons,1);
// NoSuchMethodException is thrown
obj = (TheClass)em.newInstance(TheClass.class,1);
}
}
newInstance in class MemoryAreatype - This is the class of the array instance to be created directly.args - This is a parameter that is passed to the constructor.Common Error Check.
Note :arg_types is a class array in which the results of invocation of Object.getClass() as the object are assumed as the elements of the parameter args.
java.lang.NullPointerException - The value of either one of the parameters or both the parameters type and args is null.java.lang.SecurityException - This exception is thrown when SecurityManager exists, and when any of the following conditions hold true.
java.lang.NoSuchMethodException - A public constructor having a parameter of the same type as the elements of the parameter args does not exist in the class indicated by the parameter type.java.lang.ExceptionInInitializerError - An attempt to initialize the parameter type or the class indicated by the parameter type has failed.java.lang.InstantiationException - The parameter type or the class indicated by the parameter type is either an abstract class or an interface.java.lang.reflect.InvocationTargetException - An exception occurred during the execution of the parameter type or the constructor of the class indicated by the parameter type.InaccessibleMemoryAreaException - This functionality is not supported.java.lang.IllegalAccessException - The class or its nullary constructor cannot be accessed.java.lang.IllegalArgumentException - This exception is thrown in each of the conditions.
public java.lang.Object newInstance(java.lang.reflect.Constructor cons,
java.lang.Object... args)
throws java.lang.InstantiationException,
java.lang.IllegalAccessException,
java.lang.IllegalArgumentException,
java.lang.reflect.InvocationTargetException,
InaccessibleMemoryAreaException,
java.lang.ExceptionInInitializerError,
java.lang.NullPointerException
Note: We recommend that you add the constructor of a public class in the parameter cons.
newInstance in class MemoryAreacons - This parameter specifies the constructor of the array instance to be created directly.args - This is a parameter that is passed to the constructor.Common Error Check.java.lang.NullPointerException - The value of either one or both the parameters cons and args is null.java.lang.ExceptionInInitializerError - An attempt to initialize the class with the constructor indicated by the parameter cons has failed.java.lang.InstantiationException - The constructor indicated by the parameter cons is an abstract class.java.lang.IllegalArgumentException - The parameter of the constructor indicated by the parameter cons does not match the parameter args.java.lang.IllegalAccessException - The base constructor cannot be accessed because Java language access control is executed in the Constructor object.java.lang.reflect.InvocationTargetException - An exception occurred during the execution of the constructor indicated by the parameter cons or parameter args.InaccessibleMemoryAreaException - This functionality is not supported.public java.lang.Object newArray(java.lang.Class type,
int length)
throws InaccessibleMemoryAreaException,
java.lang.NegativeArraySizeException,
java.lang.IllegalArgumentException,
java.lang.NullPointerException
newArray in class MemoryAreatype - This parameter specifies the class of the array instance to be created directly.length - This parameter specifies the length of the array instance to be created directly.Common Error Check.java.lang.NullPointerException - The parameter type is null.java.lang.NegativeArraySizeException - The parameter length is 0 or less than 0.java.lang.IllegalArgumentException - An array class for which the parameter length is more than 0 and the parameter type is more than 255 dimensions or the array class having the type Void.TYPE.InaccessibleMemoryAreaException - This functionality is not supported.public java.lang.Object newArray(java.lang.Class type,
int[] dimensions)
throws InaccessibleMemoryAreaException,
java.lang.IllegalArgumentException,
java.lang.NegativeArraySizeException,
java.lang.NullPointerException
newArray in class MemoryAreatype - This parameter specifies the class of the array instance to be created directly.dimensions - This parameter specifies the number of dimensions and elements of the array instance to be created directly.Common Error Check.java.lang.NullPointerException - The value of either one or both the parameters dimensions and type is null.java.lang.NegativeArraySizeException - The parameter dimension has an element with a negative value.java.lang.IllegalArgumentException - This exception is thrown in any of the following cases.
InaccessibleMemoryAreaException - This functionality is not supported.public long freeMemory()
throws InaccessibleMemoryAreaException
freeMemory in class MemoryAreaCommon Error Check.
0:Returned when the API processing cannot be performed. The memory size (number of bytes) that can be used for the Explicit memory block indicated by this object:When you can perform API processing, the memory size that can be used for the Explicit memory block, indicated by the object, is returned in the long type.
InaccessibleMemoryAreaException - This functionality is not supported.public long usedMemory()
throws InaccessibleMemoryAreaException
usedMemory in class MemoryAreaCommon Error Check.InaccessibleMemoryAreaException - This functionality is not supported.public long totalMemory()
throws InaccessibleMemoryAreaException
totalMemory in class MemoryAreaCommon Error Check.
0:Returned when the API processing cannot be performed. Total reserved memory size (number of bytes) of the Explicit memory block indicated by the object: When the API processing can be performed, the memory size that can be used by the Explicit memory block indicated by the object is returned to the long type.
InaccessibleMemoryAreaException - This functionality is not supported.public static void reclaim(ExplicitMemory area) throws InaccessibleMemoryAreaException
Note: This method only reserves the release processing, and does not actually perform the release processing. When the option HitachiExplicitMemoryAutoReclaim is ON (-XX:+HitachiExplicitMemoryAutoReclaim is specified), the Explicit memory block after the automatic release will execute the same operation as is executed by the Explicit memory block that is generated by the explicit memory management automatic deployment settings file. If you do not want this operation to be performed, set the option HitachiExplicitMemoryAutoReclaim to OFF (-XX:+HitachiExplicitMemoryAutoReclaim is not specified).
area - This parameter specifies the Explicit memory block for which the release processing is to be reserved.InaccessibleMemoryAreaException - This functionality is not supported.public static void reclaim(ExplicitMemory area0, ExplicitMemory area1) throws InaccessibleMemoryAreaException
Note: This method only reserves the release processing, and does not actually perform the release processing. When the option HitachiExplicitMemoryAutoReclaim is ON (-XX:+HitachiExplicitMemoryAutoReclaim is specified), the Explicit memory block after the automatic release will execute the same operation as is executed by the Explicit memory block that is generated by the explicit memory management automatic deployment settings file. If you do not want this operation to be performed, set the option HitachiExplicitMemoryAutoReclaim to OFF (-XX:+HitachiExplicitMemoryAutoReclaim is not specified).
area0 - This parameter specifies the Explicit memory block 1 for which the release processing is to be reserved.area1 - This parameter specifies the Explicit memory block 2 for which the release processing is to be reserved.InaccessibleMemoryAreaException - This functionality is not supported.public static void reclaim(ExplicitMemory... areas) throws InaccessibleMemoryAreaException, java.lang.NullPointerException
Note: This method only reserves the release processing, and does not actually perform the release processing. When the option HitachiExplicitMemoryAutoReclaim is ON (-XX:+HitachiExplicitMemoryAutoReclaim is specified), the Explicit memory block after the automatic release will execute the same operation as is executed by the Explicit memory block that is generated by the explicit memory management automatic deployment settings file. If you do not want this operation to be performed, set the option HitachiExplicitMemoryAutoReclaim to OFF (-XX:+HitachiExplicitMemoryAutoReclaim is not specified).
areas - This parameter specifies the array containing the Explicit memory block for which the release processing is to be reserved in the elements.java.lang.NullPointerException - The parameter areas is null.InaccessibleMemoryAreaException - This functionality is not supported.public static void reclaim(java.lang.Iterable<ExplicitMemory> areas) throws InaccessibleMemoryAreaException, java.lang.NullPointerException
Note: This method only reserves the release processing, and does not actually perform the release processing. When the option HitachiExplicitMemoryAutoReclaim is ON (-XX:+HitachiExplicitMemoryAutoReclaim is specified), the Explicit memory block after the automatic release will execute the same operation as is executed by the Explicit memory block that is generated by the explicit memory management automatic deployment settings file. If you do not want this operation to be performed, set the option HitachiExplicitMemoryAutoReclaim to OFF (-XX:+HitachiExplicitMemoryAutoReclaim is not specified).
areas - This parameter specifies the iterator of the Explicit memory block for which the release processing is reserved.java.lang.NullPointerException - The value of the parameter areas is null.InaccessibleMemoryAreaException - This functionality is not supported.public boolean isReclaimed()
true:either in the reserve for release state or the released state. false:This value is returned when the Explicit memory block indicated by the object is in the enabled state.
public static java.lang.management.MemoryUsage getMemoryUsage()
init:This is the initial value of the Explicit heap. This value is always 0. used:This is the memory size (number of bytes) being used in the Explicit heap. committed:This is the reserved size (number of bytes) of the Explicit heap. max:This is the value (number of bytes) of the maximum Explicit heap size specified by -XX:HitachiExplicitHeapMaxSize. However, when the option HitachiUseExplicitMemory is OFF (when -XX:+HitachiUseExplicitMemory is specified), 0 is returned.
Note: The value contained in the MemoryUsage instance is the value at the point of time when getMemoryUsage() is invoked. This value might be different from the actual value when each field is read out from the MemoryUsage instance.
public static int countExplicitMemories()
Note:
public java.lang.String toString()
toString in class MemoryAreaCopyright (C) 2015, Hitachi, Ltd.
Copyright (C) 2013, Oracle and/or its affiliates. All rights reserved.