Search in sources :

Example 1 with JDOPersistenceManager

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;
}
Also used : JDOPersistenceManager(org.datanucleus.api.jdo.JDOPersistenceManager) Field(java.lang.reflect.Field) JDOPersistenceManagerFactory(org.datanucleus.api.jdo.JDOPersistenceManagerFactory) MetaException(org.apache.hadoop.hive.metastore.api.MetaException) AlreadyExistsException(org.apache.hadoop.hive.metastore.api.AlreadyExistsException) InvalidOperationException(org.apache.hadoop.hive.metastore.api.InvalidOperationException) ConfigValSecurityException(org.apache.hadoop.hive.metastore.api.ConfigValSecurityException) SQLException(java.sql.SQLException) UnknownDBException(org.apache.hadoop.hive.metastore.api.UnknownDBException) TException(org.apache.thrift.TException) InvalidObjectException(org.apache.hadoop.hive.metastore.api.InvalidObjectException) NoSuchObjectException(org.apache.hadoop.hive.metastore.api.NoSuchObjectException)

Aggregations

Field (java.lang.reflect.Field)1 SQLException (java.sql.SQLException)1 AlreadyExistsException (org.apache.hadoop.hive.metastore.api.AlreadyExistsException)1 ConfigValSecurityException (org.apache.hadoop.hive.metastore.api.ConfigValSecurityException)1 InvalidObjectException (org.apache.hadoop.hive.metastore.api.InvalidObjectException)1 InvalidOperationException (org.apache.hadoop.hive.metastore.api.InvalidOperationException)1 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)1 NoSuchObjectException (org.apache.hadoop.hive.metastore.api.NoSuchObjectException)1 UnknownDBException (org.apache.hadoop.hive.metastore.api.UnknownDBException)1 TException (org.apache.thrift.TException)1 JDOPersistenceManager (org.datanucleus.api.jdo.JDOPersistenceManager)1 JDOPersistenceManagerFactory (org.datanucleus.api.jdo.JDOPersistenceManagerFactory)1