ソースを参照

Clear out ClientCache when UI is detached to prevent a minor memory leak (#12199)

* Clear out ClientCache when UI is detached to prevent a minor memory leak

Implemented with a listener rather than direct call from UI.detach() in
order to avoid new public API, since the whole feature has been marked
for removal. This doesn't yet prevent the cache or the type map from
getting slightly bloated during the UI's lifetime.

See: #3705
tags/8.13.0.alpha1
Anna Koskinen 3年前
コミット
f46362a731
コミッターのメールアドレスに関連付けられたアカウントが存在しません
1個のファイルの変更15行の追加0行の削除
  1. 15
    0
      server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java

+ 15
- 0
server/src/main/java/com/vaadin/server/LegacyCommunicationManager.java ファイルの表示

@@ -232,10 +232,25 @@ public class LegacyCommunicationManager implements Serializable {
if (cache == null) {
cache = new ClientCache();
uiToClientCache.put(uiId, cache);
uI.addDetachListener(event -> removeClientCache(uI));
}
return cache;
}

/**
* Clear out client cache for the given UI. This should be called when the
* UI is detached and the cache becomes obsolete.
*
* @param uI
* the UI whose client cache should be removed
* @deprecated because this cleanup is only needed for a deprecated feature
*/
@Deprecated
private void removeClientCache(UI uI) {
Integer uiId = Integer.valueOf(uI.getUIId());
uiToClientCache.remove(uiId);
}

/**
* Checks if the connector is visible in context. For Components,
* {@link #isComponentVisibleToClient(Component)} is used. For other types

読み込み中…
キャンセル
保存