本文整理匯總了Java中io.realm.Realm.isClosed方法的典型用法代碼示例。如果您正苦於以下問題:Java Realm.isClosed方法的具體用法?Java Realm.isClosed怎麽用?Java Realm.isClosed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.realm.Realm
的用法示例。
在下文中一共展示了Realm.isClosed方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openLocalInstance
import io.realm.Realm; //導入方法依賴的package包/類
/**
* Opens a reference-counted local Realm instance.
*
* @return the open Realm instance
*/
public Realm openLocalInstance() {
checkDefaultConfiguration();
Realm realm = Realm.getDefaultInstance(); // <-- consider adding parameter and Map<RealmConfiguration, ...>
Realm localRealm = localRealms.get();
if(localRealm == null || localRealm.isClosed()) {
localRealms.set(realm);
}
return realm;
}
示例2: getLocalInstance
import io.realm.Realm; //導入方法依賴的package包/類
/**
* Returns the local Realm instance without adding to the reference count.
*
* @return the local Realm instance
* @throws IllegalStateException when no Realm is open
*/
public Realm getLocalInstance() {
Realm realm = localRealms.get();
if(realm == null || realm.isClosed()) {
throw new IllegalStateException(
"No open Realms were found on this thread.");
}
return realm;
}
示例3: closeLocalInstance
import io.realm.Realm; //導入方法依賴的package包/類
/**
* Closes local Realm instance, decrementing the reference count.
*
* @throws IllegalStateException if there is no open Realm.
*/
public void closeLocalInstance() {
checkDefaultConfiguration();
Realm realm = localRealms.get();
if(realm == null || realm.isClosed()) {
throw new IllegalStateException(
"Cannot close a Realm that is not open.");
}
realm.close();
// noinspection ConstantConditions
if(Realm.getLocalInstanceCount(Realm.getDefaultConfiguration()) <= 0) {
localRealms.set(null);
}
}
示例4: openRealm
import io.realm.Realm; //導入方法依賴的package包/類
public Realm openRealm() {
Realm realm = realms.get();
if (realm != null && !realm.isClosed()) {
throw new IllegalStateException("Realm is already open");
}
realm = Realm.getDefaultInstance();
realms.set(realm);
return realm;
}
示例5: closeRealm
import io.realm.Realm; //導入方法依賴的package包/類
public void closeRealm() {
Realm realm = realms.get();
if (realm == null) {
throw new IllegalStateException("No Realm found to close");
}
if (!realm.isClosed()) {
realm.close();
}
realms.set(null);
}
示例6: isClosed
import io.realm.Realm; //導入方法依賴的package包/類
public static boolean isClosed(Realm realm) {
if (realm == null) {
return true;
} else if (realm.isClosed()) {
return true;
}
return false;
}
示例7: checkRealmValid
import io.realm.Realm; //導入方法依賴的package包/類
private void checkRealmValid(Realm realm) {
if(realm == null || realm.isClosed()) {
throw new IllegalStateException("Unexpected state: Realm is not open");
}
}
示例8: close
import io.realm.Realm; //導入方法依賴的package包/類
public static void close(Realm realm) {
if (realm != null && !realm.isClosed()) {
realm.close();
}
}
示例9: isAutoRefresh
import io.realm.Realm; //導入方法依賴的package包/類
public static void isAutoRefresh(Realm realm) {
if (realm != null && !realm.isClosed()) {
realm.isAutoRefresh();
}
}