com.sun.rtsjx
Interface CriticalThreadsMXBean


public interface CriticalThreadsMXBean

Monitoring the critical threads with the realtime garbage collector.

This class is still under development and may evolve in future versions of the product.

For a complete description of the RTGC, look at the Garbage Collection Guide. This is a short summary relevant for this particular MBean.

Critical threads are those running above a given boundary, called CriticalBoundary. Their determinism is ensured by reserving some memory for them. If memory goes below that limit, the other threads block.

This interface allows you to change the parameters and to monitor the determinism. WorstRemainingMemory is 0 when a critical thread blocked on allocation. WorstNonFragmentedMemory is 0 when a critical thread had to use a slower allocation mechanism.

Note that parameter changes might be delayed up to the next GC cycle.


Method Summary
 void changeCriticalBoundary(int priority)
          Change the critical boundary.
 long getAllocatedBytes()
          Total bytes allocated by threads running in the critical range.
 int getCriticalBoundary()
          Get the critical boundary.
 java.lang.String getDescription()
          Short description of the MBean.
 long getRecentAllocationRate()
          Bytes per milliseconds allocated by critical threads since the last call to reset().
 long getRTGCCriticalReservedBytes()
          Threshold under which non-critical threads block.
 long getWorstNonFragmentedMemory()
          Worst number of bytes usable for thread allocation buffers since the last reset().
 long getWorstRemainingMemory()
          Worst number of bytes remaining since the last reset() call.
 void reset()
          Resets the worst case numbers and long term usage computation.
 void setRTGCCriticalReservedBytes(long value)
          Changed the threshold under which non-critical threads block.
 

Method Detail

getDescription

java.lang.String getDescription()
Short description of the MBean.

Returns:
a string describing this MBean.

getCriticalBoundary

int getCriticalBoundary()
Get the critical boundary.

The critical boundary is the priority which defines the boundary between the cricital and the non-critical part of the application.

Returns:
the priority over which threads are critical.

changeCriticalBoundary

void changeCriticalBoundary(int priority)
Change the critical boundary.

Warning: if the boundary is too low, the worst case memory consumption of the critical threads increases. The amount of reserved bytes must be increased.

The change is asynchronous and might be delayed. In addition, the RTGC might apply a slightly different value to ensure the consistency of the parameters.

Parameters:
priority - new boundary for the critical threads

getRTGCCriticalReservedBytes

long getRTGCCriticalReservedBytes()
Threshold under which non-critical threads block.

Returns:
the number of bytes reserved for critical threads.

setRTGCCriticalReservedBytes

void setRTGCCriticalReservedBytes(long value)
Changed the threshold under which non-critical threads block.

If the new limit is too low, critical threads may block when the memory is exhausted. If too high, the other threads will block more often.

Parameters:
value - new threshold.

getAllocatedBytes

long getAllocatedBytes()
Total bytes allocated by threads running in the critical range.

Returns:
the bytes allocated by threads running in the critical range.

getRecentAllocationRate

long getRecentAllocationRate()
Bytes per milliseconds allocated by critical threads since the last call to reset().

Returns:
bytes per milliseconds

getWorstRemainingMemory

long getWorstRemainingMemory()
Worst number of bytes remaining since the last reset() call.

This includes the free memory chunks that are to small to be used unless the heaps gets heavily fragmented.

If a non-critical thread has blocked, this value will be less or equal to the number of reserved bytes.

If a critical thread has blocked, this value will be 0.

Returns:
the minimum amount of free memory remaining, in bytes.

getWorstNonFragmentedMemory

long getWorstNonFragmentedMemory()
Worst number of bytes usable for thread allocation buffers since the last reset().

This is the free memory that is considered by the RTGC scheduling policies. It ignores the free memory chunks that are too small to be used when the heap is not fragmented.

If a non-critical thread has failed to allocate, this will be less or equal to the number of reserved bytes. Depending on the GC policy, the thread might have blocked at that time.

If a critical thread has failed to allocate, this value will be 0. Critical threads do not block in that case but use a slower allocation mechanism.

Returns:
the minimum amount of memory big anough to allocate thread allocation buffers, in bytes

reset

void reset()
Resets the worst case numbers and long term usage computation.

This impacts getRecentAllocationRate, getWorstRemainingMemory, and getWorstNonFragmentedMemory.