Skip to content

Commit

Permalink
Better logging for sessions (#6552)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmelchior committed Jul 3, 2019
1 parent aef9e48 commit 81568ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
## 5.13.0(YYYY-MM-DD)

### Enhancements
* [ObjectServer] Improved session lifecycle debug output. (Issue [#6552](https://github.com/realm/realm-java/pull/6552)).

### Fixed
* None.

### Compatibility
* Realm Object Server: 3.21.0 or later.
* File format: Generates Realms with format v9 (Reads and upgrades all previous formats)
* APIs are backwards compatible with all previous release of realm-java in the 5.x.y series.

### Internal
* None.


## 5.12.0(2019-06-20)

### Enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ JNIEXPORT jstring JNICALL Java_io_realm_internal_OsRealmConfig_nativeCreateAndSe
// the session which should be bound.
auto bind_handler = [](const std::string& path, const SyncConfig& syncConfig,
std::shared_ptr<SyncSession> session) {
realm::jni_util::Log::d("Callback to Java requesting token for path");
realm::jni_util::Log::d("Callback to Java requesting token for path: %1", path.c_str());

JNIEnv* env = realm::jni_util::JniUtils::get_env(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ public static synchronized SyncSession getOrCreateSession(SyncConfiguration sync

SyncSession session = sessions.get(syncConfiguration.getPath());
if (session == null) {
RealmLog.debug("Creating session for: %s", syncConfiguration.getPath());
session = new SyncSession(syncConfiguration);
sessions.put(syncConfiguration.getPath(), session);
if (sessions.size() == 1) {
Expand Down Expand Up @@ -437,12 +438,13 @@ private static synchronized void removeSession(SyncConfiguration syncConfigurati
if (syncConfiguration == null) {
throw new IllegalArgumentException("A non-empty 'syncConfiguration' is required.");
}
RealmLog.debug("Removing session for: %s", syncConfiguration.getPath());
SyncSession syncSession = sessions.remove(syncConfiguration.getPath());
if (syncSession != null) {
syncSession.close();
}
if (sessions.isEmpty()) {
RealmLog.debug("last session dropped, remove network listener");
RealmLog.debug("Last session dropped. Remove network listener.");
NetworkStateReceiver.removeListener(networkListener);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public static AuthenticateResponse createValidResponseWithUser(String identifier
* @param error the network or I/O error.
*/
private AuthenticateResponse(ObjectServerError error) {
RealmLog.debug("AuthenticateResponse - Error: " + error);
setError(error);
this.accessToken = null;
this.refreshToken = null;
Expand Down

0 comments on commit 81568ef

Please sign in to comment.