Ejemplo n.º 1
0
 private void enforceLifetimeLimit(PinManagerPinMessage message) {
   if (_maxLifetime > -1) {
     long millis = _maxLifetimeUnit.toMillis(_maxLifetime);
     long requestedLifetime = message.getLifetime();
     if (requestedLifetime == -1) {
       message.setLifetime(millis);
     } else {
       message.setLifetime(Math.min(millis, requestedLifetime));
     }
   }
 }
Ejemplo n.º 2
0
  @Transactional
  protected PinTask createTask(
      PinManagerPinMessage message, MessageReply<PinManagerPinMessage> reply) {
    PnfsId pnfsId = message.getFileAttributes().getPnfsId();

    if (message.getRequestId() != null) {
      Pin pin = _dao.getPin(pnfsId, message.getRequestId());
      if (pin != null) {
        /* In this case the request is a resubmission. If the
         * previous pin completed then use it. Otherwise abort the
         * previous pin and create a new one.
         */
        if (pin.getState() == PINNED) {
          message.setPin(pin);
          reply.reply(message);
          return null;
        }

        pin.setState(UNPINNING);
        pin.setRequestId(null);
        _dao.storePin(pin);
      }
    }

    Pin pin = new Pin(message.getSubject(), pnfsId);
    pin.setRequestId(message.getRequestId());
    pin.setSticky("PinManager-" + UUID.randomUUID().toString());
    pin.setExpirationTime(getExpirationTimeForPoolSelection());

    return new PinTask(message, reply, _dao.storePin(pin));
  }