001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2011 ForgeRock AS.
015 */
016
017package org.forgerock.opendj.ldap;
018
019import java.util.EventListener;
020
021import org.forgerock.i18n.LocalizableMessage;
022
023/**
024 * An object that registers to be notified when a cancellation request has been
025 * received and processing of the request should be aborted if possible.
026 * <p>
027 * Requests may be cancelled as a result of an abandon request or a cancel
028 * extended request sent from the client, or by the server itself (e.g. during
029 * server shutdown).
030 */
031public interface CancelRequestListener extends EventListener {
032    /**
033     * Invoked when a cancellation request has been received and processing of
034     * the request should be aborted if possible.
035     * <p>
036     * Requests may be cancelled as a result of an abandon request or a cancel
037     * extended request sent from the client, or by the server itself (e.g.
038     * during server shutdown).
039     * <p>
040     * Implementations should, if possible, abort further processing of the
041     * request and return an appropriate cancellation result.
042     *
043     * @param cancellationReason
044     *            A message describing the reason why the request is being
045     *            cancelled.
046     */
047    void handleCancelRequest(LocalizableMessage cancellationReason);
048}