Back to index

munin  2.0.1
LegacyPool.java
Go to the documentation of this file.
00001 package org.munin.plugin.jmx;
00002 
00015 public enum LegacyPool {
00016        SURVIVOR("Survivor", "survivor space"), EDEN("Eden", "eden space"), TENURED_GEN(
00017                      "TenuredGen", "old gen", "tenured gen"), PERM_GEN("PermGen",
00018                      "perm gen");
00019 
00020        private final String name;
00021        private final String[] matchStrings;
00022 
00023        private LegacyPool(final String name, final String... matchStrings) {
00024               this.name = name;
00025               this.matchStrings = matchStrings;
00026        }
00027 
00028        public String getName() {
00029               return name;
00030        }
00031 
00032        public static LegacyPool getLegacyPool(final String poolName) {
00033               String generalPoolName = poolName.toLowerCase().replaceFirst(
00034                             "^(cms|ps) ", "");
00035               for (LegacyPool pool : values()) {
00036                      for (String matchString : pool.matchStrings) {
00037                             if (generalPoolName.equals(matchString)) {
00038                                    return pool;
00039                             }
00040                      }
00041               }
00042               return null;
00043        }
00044 }