Threads should not be Cloneable
Chris Hegarty
chris.hegarty at oracle.com
Fri Aug 13 13:58:29 UTC 2010
The issue of whether Threads should be Cloneable came up during the
discussion of another problem. I talked to David about this and we
believe there is no value being able to clone a thread, in fact it can
cause some strange problems. David sent a mail [1] to the
concurrency-interest mailing list requesting feedback on this. No
objections to date.
To that end, I filed CR 6968584: "Thread should not be Cloneable" and am
proposing to add the following to Thread:
/**
* Throws CloneNotSupportedException as a Thread can not be
meaningfully
* cloned. Construct a new Thread instead.
*
* @throws CloneNotSupportedException
* always
*/
protected final Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException();
}
Thanks,
-Chris.
[1]
http://cs.oswego.edu/pipermail/concurrency-interest/2010-August/007326.html
More information about the core-libs-dev
mailing list