realm-java icon indicating copy to clipboard operation
realm-java copied to clipboard

Check if `SharedGroup` in a `Realm` is valid.

Open stk1m1 opened this issue 10 years ago • 3 comments

Goal

Checking if SharedGroup in a Realm is valid.

Expected Results

In BaseRealm.checkIfValid() method, we should check if SharedGroup is closed as well.

Actual Results

In BaseRealm.checkIfValid() method, it only checks if SharedGroupManager is null or closed.

Version of Realm and tooling

Realm version(s): 0.89.1 Android Studio version: N/A Which Android version and device: N/A

stk1m1 avatar May 03 '16 05:05 stk1m1

BaseRealm.checkIfValid() is supposed to be called in the same thread where the SharedGroup is in or with some proper locks (eg. locks on RealmCache). I think current

public boolean isOpen() {
    return sharedGroup != null;
}

is good enough.

beeender avatar May 03 '16 05:05 beeender

I agree. The current behaviour should be safe enough, and since this method is called extremely often, we should keep it as efficient as possible.

cmelchior avatar May 03 '16 07:05 cmelchior

I'll close the issue.

stk1m1 avatar May 03 '16 15:05 stk1m1