Exemplo n.º 1
0
 public void doFetch() {
   synchronized (this) {
     if (consumers == null) {
       awaitingFetch = false;
       return;
     }
   }
   ImageDecoder imgd = getDecoder();
   if (imgd == null) {
     badDecoder();
   } else {
     setDecoder(imgd);
     try {
       imgd.produceImage();
     } catch (IOException e) {
       e.printStackTrace();
       // the finally clause will send an error.
     } catch (ImageFormatException e) {
       e.printStackTrace();
       // the finally clause will send an error.
     } finally {
       removeDecoder(imgd);
       if (Thread.currentThread().isInterrupted() || !Thread.currentThread().isAlive()) {
         errorAllConsumers(imgd.queue, true);
       } else {
         errorAllConsumers(imgd.queue, false);
       }
     }
   }
 }