use of org.datanucleus.api.jdo.JDOPersistenceManager in project hive by apache.
the class TestHiveMetaStore method getJDOPersistanceManagerCacheSize.
private static int getJDOPersistanceManagerCacheSize() {
JDOPersistenceManagerFactory jdoPmf;
Set<JDOPersistenceManager> pmCacheObj;
Field pmCache;
Field pmf;
try {
pmf = ObjectStore.class.getDeclaredField("pmf");
if (pmf != null) {
pmf.setAccessible(true);
jdoPmf = (JDOPersistenceManagerFactory) pmf.get(null);
pmCache = JDOPersistenceManagerFactory.class.getDeclaredField("pmCache");
if (pmCache != null) {
pmCache.setAccessible(true);
pmCacheObj = (Set<JDOPersistenceManager>) pmCache.get(jdoPmf);
if (pmCacheObj != null) {
return pmCacheObj.size();
}
}
}
} catch (Exception ex) {
System.out.println(ex);
}
return -1;
}
Aggregations