001 /*
002 * Copyright 2010-2013 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2010-2013 UnboundID Corp.
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021 package com.unboundid.ldap.listener;
022
023
024
025 import java.net.Socket;
026
027 import com.unboundid.ldap.sdk.LDAPException;
028 import com.unboundid.util.Extensible;
029 import com.unboundid.util.ThreadSafety;
030 import com.unboundid.util.ThreadSafetyLevel;
031
032
033
034 /**
035 * This interface defines an API that may be implemented by a class that should
036 * be notified whenever a problem occurs with the LDAP listener or any of its
037 * associated connections in a manner that may not be directly visible to the
038 * caller.
039 */
040 @Extensible()
041 @ThreadSafety(level=ThreadSafetyLevel.INTERFACE_THREADSAFE)
042 public interface LDAPListenerExceptionHandler
043 {
044 /**
045 * Indicates that the specified connection is about to be terminated because
046 * an unexpected error occurred during processing.
047 *
048 * @param socket The socket to be used for the failed connection. It may be
049 * {@code null} if the failure occurred while attempting to
050 * accept the socket rather than attempting to create the
051 * client connection from an accepted socket.
052 * @param cause An exception providing additional information about the
053 * problem that occurred. It will not be {@code null}.
054 */
055 void connectionCreationFailure(final Socket socket, final Throwable cause);
056
057
058
059 /**
060 * Indicates that the specified connection is about to be terminated because
061 * an unexpected error occurred during processing.
062 *
063 * @param connection The connection that will be terminated. It will not be
064 * {@code null}.
065 * @param cause An exception providing additional information about the
066 * reason for the termination. It will not be
067 * {@code null}.
068 */
069 void connectionTerminated(final LDAPListenerClientConnection connection,
070 final LDAPException cause);
071 }