You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my sample application, I collect closeable lazy objects (such as database connections) through a set, and then close these objects at the right time. However, I cannot determine whether the lazy object has been initialized. If a closeable object has not been accessed anywhere, it should be uninitialized. This object should be skipped when traversing the collection and closing it. However, I cannot determine whether the lazy object has been initialized. If I access the closeable object at this time, the object may be initialized when it is created, and then closed immediately. This behavior is meaningless and may be a time-consuming operation. Therefore, if lazy has an API to determine whether it has been initialized, this problem can be solved.
@Chang-Eric and I discussed this briefly. It seems reasonable.
I think #2353 would likely also solve your issue since you are using Kotlin. Fwiw, you can probably use the same workarounds suggested in #2353 to convert to kotlin.Lazy.
In my sample application, I collect closeable lazy objects (such as database connections) through a set, and then close these objects at the right time. However, I cannot determine whether the lazy object has been initialized. If a closeable object has not been accessed anywhere, it should be uninitialized. This object should be skipped when traversing the collection and closing it. However, I cannot determine whether the lazy object has been initialized. If I access the closeable object at this time, the object may be initialized when it is created, and then closed immediately. This behavior is meaningless and may be a time-consuming operation. Therefore, if lazy has an API to determine whether it has been initialized, this problem can be solved.
The text was updated successfully, but these errors were encountered: