Search in sources :

Example 1 with SRMFileBusyException

use of org.dcache.srm.SRMFileBusyException in project dcache by dCache.

the class PutFileRequest method run.

@Override
public void run() throws IllegalStateTransition, SRMException {
    LOGGER.trace("run");
    if (!getState().isFinal()) {
        if (getFileId() == null) {
            // SRM_DUPLICATION_ERROR must be returned at the file level.
            if (SRM.getSRM().hasMultipleUploads(getSurl())) {
                if (!getContainerRequest().isOverwrite()) {
                    throw new SRMDuplicationException("The requested SURL is locked by another upload.");
                } else {
                    throw new SRMFileBusyException("The requested SURL is locked by another upload.");
                }
            }
            addHistoryEvent("Doing name space lookup.");
            SRMUser user = getUser();
            CheckedFuture<String, ? extends SRMException> future = getStorage().prepareToPut(user, getSurl(), getSize(), Objects.toString(getAccessLatency(), null), Objects.toString(getRetentionPolicy(), null), getSpaceReservationId(), getContainerRequest().isOverwrite());
            future.addListener(new PutCallbacks(user, getId(), surl, future), MoreExecutors.directExecutor());
            return;
        }
        computeTurl();
        wlock();
        try {
            if (getState() == State.INPROGRESS) {
                setState(State.RQUEUED, "Putting on a \"Ready\" Queue.");
            }
        } finally {
            wunlock();
        }
    }
}
Also used : SRMUser(org.dcache.srm.SRMUser) SRMFileBusyException(org.dcache.srm.SRMFileBusyException) SRMDuplicationException(org.dcache.srm.SRMDuplicationException)

Aggregations

SRMDuplicationException (org.dcache.srm.SRMDuplicationException)1 SRMFileBusyException (org.dcache.srm.SRMFileBusyException)1 SRMUser (org.dcache.srm.SRMUser)1