Example #1
0
 @Transactional
 protected void clearPin(PinTask task) {
   if (task.getPool() != null) {
     /* If the pin record expired or the pin was explicitly
      * unpinned, then the unpin processor may already have
      * submitted a request to the pool to clear the sticky
      * flag. Although out of order delivery of messages is
      * unlikely, if it would happen then we have a race
      * between the set sticky and clear sticky messages. To
      * cover this case we delete the old record and create a
      * fresh one in UNPINNING.
      */
     _dao.deletePin(task.getPin());
     Pin pin = new Pin(task.getSubject(), task.getPnfsId());
     pin.setState(UNPINNING);
     _dao.storePin(pin);
   } else {
     /* We didn't create a sticky flag yet, so there is no
      * reason to keep the record. It will expire by itself,
      * but we delete the record now to avoid that we get
      * tickets from admins wondering why they have records
      * staying in PINNING.
      */
     _dao.deletePin(task.getPin());
   }
 }