[concurrency-interest] Threads should not be Cloneable

David Holmes davidcholmes at aapt.net.au
Wed Aug 4 08:31:29 EDT 2010


Cloning a started thread makes no sense and is fundamentally broken at the
moment - you can get various weird things to occur. Cloning an unstarted
thread would be harmless but achieves nothing that a constructor doesn't
already achieve - and avoids icky issues like managing names and ids.

To close the door on this weirdness and remove any doubt as to whether
Threads should be cloneable or not, the core-libs folks in Oracle (plus
myself) are proposing that for Java 7 we simply specify that Thread.clone()
throws CloneNotSupportedException.

We expect that this would go unnoticed by 99.99999% of developers but wanted
to solicit comments in case we had overlooked an important use case (which
is doubtful considering it doesn't actually work :) ).

Thanks,
David Holmes
Java Platform Group
Oracle




More information about the Concurrency-interest mailing list