8301367: Add exception handler method to the BaseLdapServer

Reviewed-by: jpai, vtewari, dfuchs
This commit is contained in:
Aleksei Efimov 2023-02-02 12:45:00 +00:00
parent 7b6ac41ab1
commit 03b23a1e1b

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -173,7 +173,7 @@ public class BaseLdapServer implements Closeable {
if (!isRunning()) {
logger.log(INFO, "Connection Handler exit {0}", t.getMessage());
} else {
t.printStackTrace();
handleSocketException(socket, t);
}
}
@ -189,6 +189,15 @@ public class BaseLdapServer implements Closeable {
*/
protected void beforeConnectionHandled(Socket socket) { /* empty */ }
/*
* Called to handle exceptions observed on an established client connection.
*
* By default, an exception stack trace is printed.
*/
protected void handleSocketException(Socket socket, Throwable exception) {
exception.printStackTrace();
}
/*
* Called after an LDAP request has been read in `handleConnection()`.
*