APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.management

public Class GcInfo

extends Object
implements CompositeData, CompositeDataView
Class Inheritance
All Implemented Interfaces
javax.management.openmbean.CompositeDataView, javax.management.openmbean.CompositeData
Imports
java.lang.management.MemoryUsage, javax.management.openmbean.CompositeData, .CompositeDataView, .CompositeType, java.util.Collection, .Collections, .HashMap, .Map, com.sun.management.internal.GcInfoCompositeData, .GcInfoBuilder

Garbage collection information. It contains the following information for one garbage collection as well as GC-specific attributes:

GcInfo is a CompositeData The GC-specific attributes can be obtained via the CompositeData interface. This is a historical relic, and other classes should not copy this pattern. Use CompositeDataView instead.

MXBean Mapping

GcInfo is mapped to a CompositeData with attributes as specified in the from method.
Author
Mandy Chung
Since
1.5

Field Summary

Modifier and TypeField and Description
private final GcInfoBuilder
private final CompositeData
private final long
private final Object[]
private final long
private final long
private final Map<String, MemoryUsage>
private final Map<String, MemoryUsage>

Constructor Summary

AccessConstructor and Description
private
GcInfo(GcInfoBuilder builder, long index, long startTime, long endTime, MemoryUsage[] muBeforeGc, MemoryUsage[] muAfterGc, Object[] extAttributes)

private

Method Summary

Modifier and TypeMethod and Description
public boolean
containsKey(String key)

Implements javax.management.openmbean.CompositeData.containsKey.

Returns true if and only if this CompositeData instance contains an item whose name is key.

public boolean
containsValue(Object value)

Implements javax.management.openmbean.CompositeData.containsValue.

Returns true if and only if this CompositeData instance contains an item whose value is value.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Implements javax.management.openmbean.CompositeData.equals.

Compares the specified obj parameter with this CompositeData instance for equality.

public static GcInfo

Returns:

a GcInfo object represented by cd if cd is not null; null otherwise.
from
(CompositeData cd)

Returns a GcInfo object represented by the given CompositeData.

public Object
get(String key)

Implements javax.management.openmbean.CompositeData.get.

Returns the value of the item whose name is key.

public Object[]
getAll(String[] keys)

Implements javax.management.openmbean.CompositeData.getAll.

Returns an array of the values of the items whose names are specified by keys, in the same order as keys.

public CompositeType
getCompositeType()

Implements javax.management.openmbean.CompositeData.getCompositeType.

Returns the composite type of this composite data instance.

public long

Returns:

the elapsed time of this GC in milliseconds.
getDuration
()

Returns the elapsed time of this GC in milliseconds.

public long

Returns:

the end time of this GC.
getEndTime
()

Returns the end time of this GC in milliseconds since the Java virtual machine was started.

public long

Returns:

the identifier of this garbage collection which is the number of collections that this collector has done.
getId
()

Returns the identifier of this garbage collection which is the number of collections that this collector has done.

public Map<String, MemoryUsage>

Returns:

a Map of memory pool names to the memory usage of a memory pool when GC finishes.
getMemoryUsageAfterGc
()

Returns the memory usage of all memory pools at the end of this GC.

public Map<String, MemoryUsage>

Returns:

a Map of memory pool names to the memory usage of a memory pool before GC starts.
getMemoryUsageBeforeGc
()

Returns the memory usage of all memory pools at the beginning of this GC.

public long

Returns:

the start time of this GC.
getStartTime
()

Returns the start time of this GC in milliseconds since the Java virtual machine was started.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements javax.management.openmbean.CompositeData.hashCode.

Returns the hash code value for this CompositeData instance.

public CompositeData

Returns:

the CompositeData representation.
toCompositeData
(CompositeType
the CompositeType that the caller expects. This parameter is ignored and can be null.
ct
)

Implements javax.management.openmbean.CompositeDataView.toCompositeData.

Return the CompositeData representation of this GcInfo, including any GC-specific attributes.

public String
toString()

Overrides java.lang.Object.toString.

Implements javax.management.openmbean.CompositeData.toString.

Returns a string representation of this CompositeData instance.

public Collection<?>
values()

Implements javax.management.openmbean.CompositeData.values.

Returns an unmodifiable Collection view of the item values contained in this CompositeData instance.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

builderback to summary
private final GcInfoBuilder builder
cdataback to summary
private final CompositeData cdata
endTimeback to summary
private final long endTime
extAttributesback to summary
private final Object[] extAttributes
indexback to summary
private final long index
startTimeback to summary
private final long startTime
usageAfterGcback to summary
private final Map<String, MemoryUsage> usageAfterGc
usageBeforeGcback to summary
private final Map<String, MemoryUsage> usageBeforeGc

Constructor Detail

GcInfoback to summary
private GcInfo(GcInfoBuilder builder, long index, long startTime, long endTime, MemoryUsage[] muBeforeGc, MemoryUsage[] muAfterGc, Object[] extAttributes)
GcInfoback to summary
private GcInfo(CompositeData cd)

Method Detail

containsKeyback to summary
public boolean containsKey(String key)

Implements javax.management.openmbean.CompositeData.containsKey.

Doc from javax.management.openmbean.CompositeData.containsKey.

Returns true if and only if this CompositeData instance contains an item whose name is key. If key is a null or empty String, this method simply returns false.

containsValueback to summary
public boolean containsValue(Object value)

Implements javax.management.openmbean.CompositeData.containsValue.

Doc from javax.management.openmbean.CompositeData.containsValue.

Returns true if and only if this CompositeData instance contains an item whose value is value.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Implements javax.management.openmbean.CompositeData.equals.

Doc from javax.management.openmbean.CompositeData.equals.

Compares the specified obj parameter with this CompositeData instance for equality.

Returns true if and only if all of the following statements are true:

  • obj is non null,
  • obj also implements the CompositeData interface,
  • their composite types are equal
  • their contents, i.e. (name, value) pairs are equal. If a value contained in the content is an array, the value comparison is done as if by calling the deepEquals method for arrays of object reference types or the appropriate overloading of Arrays.equals(e1,e2) for arrays of primitive types

This ensures that this equals method works properly for obj parameters which are different implementations of the CompositeData interface, with the restrictions mentioned in the equals method of the java.util.Collection interface.

fromback to summary
public static GcInfo from(CompositeData cd)

Returns a GcInfo object represented by the given CompositeData. The given CompositeData must contain all the following attributes:

description
Attribute Name Type
index java.lang.Long
startTime java.lang.Long
endTime java.lang.Long
memoryUsageBeforeGc javax.management.openmbean.TabularData
memoryUsageAfterGc javax.management.openmbean.TabularData
Returns:GcInfo

a GcInfo object represented by cd if cd is not null; null otherwise.

Exceptions
IllegalArgumentException:
if cd does not represent a GcInfo object with the attributes described above.
getback to summary
public Object get(String key)

Implements javax.management.openmbean.CompositeData.get.

Doc from javax.management.openmbean.CompositeData.get.

Returns the value of the item whose name is key.

getAllback to summary
public Object[] getAll(String[] keys)

Implements javax.management.openmbean.CompositeData.getAll.

Doc from javax.management.openmbean.CompositeData.getAll.

Returns an array of the values of the items whose names are specified by keys, in the same order as keys.

getCompositeTypeback to summary
public CompositeType getCompositeType()

Implements javax.management.openmbean.CompositeData.getCompositeType.

Doc from javax.management.openmbean.CompositeData.getCompositeType.

Returns the composite type of this composite data instance.

getDurationback to summary
public long getDuration()

Returns the elapsed time of this GC in milliseconds.

Returns:long

the elapsed time of this GC in milliseconds.

getEndTimeback to summary
public long getEndTime()

Returns the end time of this GC in milliseconds since the Java virtual machine was started.

Returns:long

the end time of this GC.

getIdback to summary
public long getId()

Returns the identifier of this garbage collection which is the number of collections that this collector has done.

Returns:long

the identifier of this garbage collection which is the number of collections that this collector has done.

getMemoryUsageAfterGcback to summary
public Map<String, MemoryUsage> getMemoryUsageAfterGc()

Returns the memory usage of all memory pools at the end of this GC. This method returns a Map of the name of a memory pool to the memory usage of the corresponding memory pool when GC finishes.

Returns:Map<String, MemoryUsage>

a Map of memory pool names to the memory usage of a memory pool when GC finishes.

getMemoryUsageBeforeGcback to summary
public Map<String, MemoryUsage> getMemoryUsageBeforeGc()

Returns the memory usage of all memory pools at the beginning of this GC. This method returns a Map of the name of a memory pool to the memory usage of the corresponding memory pool before GC starts.

Returns:Map<String, MemoryUsage>

a Map of memory pool names to the memory usage of a memory pool before GC starts.

getStartTimeback to summary
public long getStartTime()

Returns the start time of this GC in milliseconds since the Java virtual machine was started.

Returns:long

the start time of this GC.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements javax.management.openmbean.CompositeData.hashCode.

Doc from javax.management.openmbean.CompositeData.hashCode.

Returns the hash code value for this CompositeData instance.

The hash code of a CompositeData instance is the sum of the hash codes of all elements of information used in equals comparisons (ie: its composite type and all the item values).

This ensures that t1.equals(t2) implies that t1.hashCode()==t2.hashCode() for any two CompositeData instances t1 and t2, as required by the general contract of the method Object.hashCode().

Each item value's hash code is added to the returned hash code. If an item value is an array, its hash code is obtained as if by calling the deepHashCode method for arrays of object reference types or the appropriate overloading of Arrays.hashCode(e) for arrays of primitive types.

toCompositeDataback to summary
public CompositeData toCompositeData(CompositeType ct)

Implements javax.management.openmbean.CompositeDataView.toCompositeData.

Return the CompositeData representation of this GcInfo, including any GC-specific attributes. The returned value will have at least all the attributes described in the from method, plus optionally other attributes.

Parameters
ct:CompositeType

the CompositeType that the caller expects. This parameter is ignored and can be null.

Returns:CompositeData

the CompositeData representation.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Implements javax.management.openmbean.CompositeData.toString.

Doc from javax.management.openmbean.CompositeData.toString.

Returns a string representation of this CompositeData instance.

The string representation consists of the name of the implementing class, the string representation of the composite type of this instance, and the string representation of the contents (ie list the itemName=itemValue mappings).

valuesback to summary
public Collection<?> values()

Implements javax.management.openmbean.CompositeData.values.

Doc from javax.management.openmbean.CompositeData.values.

Returns an unmodifiable Collection view of the item values contained in this CompositeData instance. The returned collection's iterator will return the values in the ascending lexicographic order of the corresponding item names.