[cp-patches] FYI: Addition of threading bean

Tom Tromey tromey at redhat.com
Tue Jun 27 15:41:52 UTC 2006


>>>>> "Andrew" == Andrew John Hughes <a.hughes at dcs.shef.ac.uk> writes:

Andrew> I would have preferred to go with an int, but there seems to
Andrew> be no method in the Enum class to convert ints back into
Andrew> enums, while there is one for Strings.

We can always have a switch in Thread.getState.

The issue with a String for the state is that either you will need to
allocate a new one on each state change (expensive) or you will need
to cache the String value somewhere.  But if you're doing the latter
then you might as well just be using an enum field anyway.

Andrew> Yeah, I wasn't too sure how you'd implemented this; is there
Andrew> already some way of passing in an id and getting the
Andrew> corresponding thread?

I don't know of one.

Tom



More information about the Classpath-patches mailing list