Add NoThreadClone#isShareable method so the elements can dynamically decide if they need cloning or not#5916
Add NoThreadClone#isShareable method so the elements can dynamically decide if they need cloning or not#5916vlsi wants to merge 1 commit intoapache:masterfrom
Conversation
…decide if they need cloning or not Previously, components could implements NoThreadClone to prevent cloning in each thread, however, there was no way to "unimplement" the interface. By default, isShareable returns true, so existing components work as before.
|
It looks like another API is needed so the component can figure out if the actual element has been cloned or not. For instance, in case like #727, It sounds like Then Unfortunately, it reminds me of the new memory management in Kotlin Native : https://kotlinlang.org/docs/native-migration-guide.html |
Motivation and Context
Previously, components could
implements NoThreadCloneto prevent cloning in each thread, however, there was no way to "unimplement" the interface.By default,
isShareablereturns true, so existing components work as before.This improvement is needed for:
Map<ThreadGroup, ...>, however, making timer clonable or non-clonable depending on "local vs global" property might be a nicer way to code timers.