本文整理汇总了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();
}
}