Ejemplo n.º 1
0
 @Override
 public void removeFrom(ObjectContainer container, ClientContext context) {
   super.removeFrom(container, context);
   if (deleteFetchContext) {
     container.activate(ctx, 1);
     ctx.removeFrom(container);
   }
   container.activate(key, 5);
   key.removeFrom(container);
 }
Ejemplo n.º 2
0
  @Override
  public void requestWasRemoved(ObjectContainer container, ClientContext context) {
    // if request is still running, send a GetFailed with code=cancelled
    if (!finished) {
      synchronized (this) {
        succeeded = false;
        finished = true;
        FetchException cancelled = new FetchException(FetchException.CANCELLED);
        getFailedMessage = new GetFailedMessage(cancelled, identifier, global);
      }
      trySendDataFoundOrGetFailed(null, container);
    }
    // notify client that request was removed
    FCPMessage msg = new PersistentRequestRemovedMessage(getIdentifier(), global);
    if (persistenceType != PERSIST_CONNECTION) {
      if (persistenceType == PERSIST_FOREVER) container.activate(client, 1);
      client.queueClientRequestMessage(msg, 0, container);
    }

    freeData(container);

    if (persistenceType == PERSIST_FOREVER) {
      container.activate(fctx, 1);
      if (fctx.allowedMIMETypes != null) {
        container.activate(fctx.allowedMIMETypes, 5);
        container.delete(fctx.allowedMIMETypes);
      }
      fctx.removeFrom(container);
      getter.removeFrom(container, context);
      if (targetFile != null) container.delete(targetFile);
      if (tempFile != null) container.delete(tempFile);
      if (getFailedMessage != null) {
        container.activate(getFailedMessage, 5);
        getFailedMessage.removeFrom(container);
      }
      if (postFetchProtocolErrorMessage != null) {
        container.activate(postFetchProtocolErrorMessage, 5);
        postFetchProtocolErrorMessage.removeFrom(container);
      }
      if (allDataPending != null) {
        container.activate(allDataPending, 5);
        allDataPending.removeFrom(container);
      }
      if (progressPending != null) {
        container.activate(progressPending, 5);
        progressPending.removeFrom(container);
      }
    }
    super.requestWasRemoved(container, context);
  }