Source:
<code>private synchronized <E extends BaseRealm> E doCreateRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { RefAndCount refAndCount = refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (getTotalGlobalRefCount() == 0) { copyAssetFileIfNeeded(configuration); boolean fileExists = new File(configuration.getPath()).exists(); SharedRealm sharedRealm = null; try { sharedRealm = SharedRealm.getInstance(configuration); if (!fileExists) { try { ObjectServerFacade.getSyncFacadeIfPossible().downloadRemoteChanges(configuration); } catch (InterruptedException e) { <START> throw new DownloadingRealmInterruptedException(e); <END> } } if (Table.primaryKeyTableNeedsMigration(sharedRealm)) { sharedRealm.beginTransaction(); if (Table.migratePrimaryKeyTableIfNeeded(sharedRealm)) { sharedRealm.commitTransaction(); } else { sharedRealm.cancelTransaction(); } } } finally { if (sharedRealm != null) { sharedRealm.close(); } } this.configuration = configuration; } else { validateConfiguration(configuration); } if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(this); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(this); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); if (realmClass == Realm.class && refAndCount.globalCount == 0) { RealmCache.storeColumnIndices(typedColumnIndicesArray, realm.schema.cloneColumnIndices()); } refAndCount.globalCount++; } Integer refCount = refAndCount.localCount.get(); refAndCount.localCount.set(refCount + 1); return (E) refAndCount.localRealm.get(); }</code><technical_language>remove Realm management files</technical_language>

Target:
private synchronized <E extends BaseRealm> E doCreateRealmOrGetFromCache(RealmConfiguration configuration, Class<E> realmClass) { RefAndCount refAndCount = refAndCountMap.get(RealmCacheType.valueOf(realmClass)); if (getTotalGlobalRefCount() == 0) { copyAssetFileIfNeeded(configuration); boolean fileExists = configuration.realmExists(); SharedRealm sharedRealm = null; try { sharedRealm = SharedRealm.getInstance(configuration); if (!fileExists) { try { ObjectServerFacade.getSyncFacadeIfPossible().downloadRemoteChanges(configuration); } catch (Throwable t) { sharedRealm.close(); sharedRealm = null; Realm.deleteRealm(configuration); throw t; } } if (Table.primaryKeyTableNeedsMigration(sharedRealm)) { sharedRealm.beginTransaction(); if (Table.migratePrimaryKeyTableIfNeeded(sharedRealm)) { sharedRealm.commitTransaction(); } else { sharedRealm.cancelTransaction(); } } } finally { if (sharedRealm != null) { sharedRealm.close(); } } this.configuration = configuration; } else { validateConfiguration(configuration); } if (refAndCount.localRealm.get() == null) { BaseRealm realm; if (realmClass == Realm.class) { realm = Realm.createInstance(this); } else if (realmClass == DynamicRealm.class) { realm = DynamicRealm.createInstance(this); } else { throw new IllegalArgumentException(WRONG_REALM_CLASS_MESSAGE); } refAndCount.localRealm.set(realm); refAndCount.localCount.set(0); if (realmClass == Realm.class && refAndCount.globalCount == 0) { RealmCache.storeColumnIndices(typedColumnIndicesArray, realm.schema.cloneColumnIndices()); } refAndCount.globalCount++; } Integer refCount = refAndCount.localCount.get(); refAndCount.localCount.set(refCount + 1); return (E) refAndCount.localRealm.get(); }