ECode HttpRequestBase::Abort()
{
    AutoPtr<IClientConnectionRequest> localRequest;
    AutoPtr<IConnectionReleaseTrigger> localTrigger;

    mAbortLock->Lock();
    // try {
    if (mAborted) {
        mAbortLock->UnLock();
        return NOERROR;
    }
    mAborted = TRUE;

    localRequest = mConnRequest;
    localTrigger = mReleaseTrigger;
    mAbortLock->UnLock();
    // } finally {
    //     this.abortLock.unlock();
    // }

    // Trigger the callbacks outside of the lock, to prevent
    // deadlocks in the scenario where the callbacks have
    // their own locks that may be used while calling
    // setReleaseTrigger or setConnectionRequest.
    if (localRequest != NULL) {
        localRequest->AbortRequest();
    }
    if (localTrigger != NULL) {
        // try {
        localTrigger->AbortConnection();
        // } catch (IOException ex) {
        //     // ignore
        // }
    }
    return NOERROR;
}