[concurrency-interest] Thread interruptionprotocol:InterruptedException is a "checked" exception, correct?

Péter Kovács peter.kovacs.1.0rc at gmail.com
Thu May 21 08:29:47 EDT 2009


Bingo! We use 1.5.0_15. Thank you, David, for this info! It helps a lot.

May I push on with this issue?

Can you, please, tell me how Class.forName is supposed to handle
thread interruptions? Will/should it simply ignore them? (What else
could it do about interruption.)

Also, I am a bit uncertain about the notion of thread interruption in
this context. Does it mean a purely Java mechanism? Inside the JVM
only? Or does it translate to some operating system mechanism -- on
some platforms, perhaps (on Solaris e.g.)? Are there ways to interrupt
a Java thread apart from the Thread.interrupt() API call (through some
operating system facilities e.g.)?

Thanks,
Peter

On Wed, May 20, 2009 at 10:55 PM, David Holmes <davidcholmes at aapt.net.au> wrote:
> I wrote:
>> In fact I think this affects all JDK 5 versions of Hotspot.
>
> It's just been fixed in 5u18
>
> David
>
>>
>> David Holmes
>>
>> > -----Original Message-----
>> > From: concurrency-interest-bounces at cs.oswego.edu
>> > [mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Peter
>> > Kovacs
>> > Sent: Thursday, 21 May 2009 2:06 AM
>> > To: Paulo Levi
>> > Cc: concurrency-interest at cs.oswego.edu; Tom Hawtin
>> > Subject: Re: [concurrency-interest] Thread interruption
>> > protocol:InterruptedException is a "checked" exception, correct?
>> >
>> >
>> >
>> > Oh, I see Constructor.newInstance() as opposed to Class.newInstance().
>> > But this probably irrelevant here as the stack trace fragment I
>> > produced in my previous mail appears to show that the exception is
>> > from Class.forName(String). Also, we call Constructor.newInstance()
>> > instead of Class.newInstance():
>> >
>> >         Class<?> cl = Class.forName(name);
>> >         Constructor constr = cl.getConstructor(argcl);
>> >         return constr.newInstance(args);
>> >
>> > I was just trying to apply Tom's input about passing exception
>> > checking to the case we appear to have.
>> >
>> > Thanks for making me aware of the difference anyway.
>> >
>> > Peter
>> >
>> >
>> > 2009/5/20 Paulo Levi <i30817 at gmail.com>:
>> > > You're not reading the javadoc correctly:
>> > > newInstance()
>> > > "Note that this method propagates any exception thrown by the nullary
>> > > constructor, including a checked exception. Use of this method
>> > effectively
>> > > bypasses the compile-time exception checking that would otherwise be
>> > > performed by the compiler. The Constructor.newInstance method
>> > avoids this
>> > > problem by wrapping any exception thrown by the constructor in
>> > a (checked)
>> > > InvocationTargetException."
>> > >
>> > _______________________________________________
>> > Concurrency-interest mailing list
>> > Concurrency-interest at cs.oswego.edu
>> > http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>>
>>
>> _______________________________________________
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.oswego.edu
>> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest
>



More information about the Concurrency-interest mailing list