|
4 | 4 |
|
5 | 5 | /**
|
6 | 6 | * Users can implement this interface to override the default SQLException handling
|
7 |
| - * of HikariCP. By the time an instance of this interface is invoked HikariCP has |
8 |
| - * already made a determination to evict the Connection from the pool. |
9 |
| - * |
10 |
| - * If the {@link #adjudicate(SQLException)} method returns {@link Override#CONTINUE_EVICT} the eviction will occur, but if the |
11 |
| - * method returns {@link Override#DO_NOT_EVICT} the eviction will be elided. |
| 7 | + * of HikariCP. When a SQLException is thrown from JDBC execution methods, the |
| 8 | + * SQLState and error code will be checked to determine if the connection should |
| 9 | + * be evicted from the pool. |
| 10 | + * <p> |
| 11 | + * By supplying an implementation of this interface, users can override the default |
| 12 | + * handling of SQLExceptions. The {@link #adjudicate(SQLException)} method will be called |
| 13 | + * with the SQLException that was thrown. If the method returns {@link Override#CONTINUE_EVICT} |
| 14 | + * the customary built-in handling will occur. If the method returns {@link Override#DO_NOT_EVICT} |
| 15 | + * the eviction will be elided. If the method returns {@link Override#MUST_EVICT} the eviction will |
| 16 | + * be evicted regardless of the SQLState or error code. |
12 | 17 | */
|
13 | 18 | public interface SQLExceptionOverride {
|
14 | 19 | enum Override {
|
15 | 20 | CONTINUE_EVICT,
|
16 |
| - DO_NOT_EVICT |
| 21 | + DO_NOT_EVICT, |
| 22 | + MUST_EVICT |
17 | 23 | }
|
18 | 24 |
|
19 | 25 | /**
|
20 |
| - * If this method returns {@link Override#CONTINUE_EVICT} then Connection eviction will occur, but if it |
21 |
| - * returns {@link Override#DO_NOT_EVICT} the eviction will be elided. |
| 26 | + * This method is called when a SQLException is thrown from a JDBC method. |
22 | 27 | *
|
23 |
| - * @param sqlException the #SQLException to adjudicate |
24 |
| - * @return either one of {@link Override#CONTINUE_EVICT} or {@link Override#DO_NOT_EVICT} |
| 28 | + * @param sqlException the SQLException that was thrown |
| 29 | + * @return an {@link Override} value indicating how eviction should proceed |
25 | 30 | */
|
26 | 31 | default Override adjudicate(final SQLException sqlException)
|
27 | 32 | {
|
|
0 commit comments