private static MemoryPoolMXBean findTenuredGenPool ( ) { // I don't know whether this approach is better, or whether // we should rather check for the pool name "Tenured Gen"? for ( final MemoryPoolMXBean pool : ManagementFactory . getMemoryPoolMXBeans ( ) ) if ( pool . getType ( ) == MemoryType . HEAP && pool . isUsageThresholdSupported ( ) ) { return pool ; } throw new AssertionError ( "Could not find tenured space" ) ; }
Tenured Space Pool can be determined by it being of type HEAP and by it being possible to set the usage threshold .