[concurrency-interest] Swing translates InterruptedException to Error

Tom Cargill cargill@profcon.com
Fri, 06 Jun 2003 10:35:38 -0600


[If this is off-topic, just ignore me.]

I just encountered the following code in

    javax/swing/text/AbstractDocument.java

The practice of translating an InterruptedException to an Error
strikes me as bizarre. Can anyone offer a rationale for this policy?

====================================================================

protected
synchronized
final
void writeLock() {
   try {
     while ((numReaders > 0) || (currWriter != null)) {
       if (Thread.currentThread() == currWriter) {
         if (notifyingListeners) {
           throw new IllegalStateException("Attempt to mutate in 
notification");
         }
         numWriters++;
         return;
       }
       wait();
     }
     currWriter = Thread.currentThread();
     numWriters = 1;
   } catch (InterruptedException e) {
     throw new Error("Interrupted attempt to aquire write lock");
   }
}
~~
http://www.profcon.com/cargill