/** * 注销EMF * * @param db */ public static synchronized void unregisteEmf(DbClient db) { DbClientInfo bean = emfMap.remove(db); if (JefMonitorRegister.isJmxEnable()) { JefMonitorRegister.unregiste( "JefDbClient:key=Db@" + Integer.toHexString(db.hashCode()), bean); } }
/** * 记录所有的db和emf * * @param db * @param emf */ public static synchronized void registeEmf(DbClient db, JefEntityManagerFactory emf) { DbClientInfo stat = emfMap.get(db); if (stat == null) { stat = new DbClientInfo(db); stat.setDbClientFactory(emf); emfMap.put(db, stat); if (JefMonitorRegister.isJmxEnable()) { JefMonitorRegister.registe( "JefDbClient:key=Db@" + Integer.toHexString(db.hashCode()), stat); } } else { stat.setDbClientFactory(emf); } initOrmConfig(); }