ExceptionHandler
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Interface for handling errors and defining a retry policy.
Public Method Summary
abstract
boolean
|
handleException(Exception ex, int ntries)
Determines how to proceed after an exception is thrown.
|
Public Methods
public
abstract
boolean
handleException
(Exception ex, int ntries)
Determines how to proceed after an exception is thrown.
The connector code passes the exception along with the number of attempts to the method.
Implementations might call Thread.sleep()
to delay or back off before
returning.
Parameters
ex |
the exception that occurred |
ntries |
the number of consecutive failures for the current operation |
Returns
true
for an immediate retry or false
to abort
Throws
InterruptedException |
if an interruption occurs during the back off
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-03-18 UTC.
[null,null,["Last updated 2025-03-18 UTC."],[],[],null,["# ExceptionHandler\n\npublic interface **ExceptionHandler** \n\n|---|---|---|\n| Known Indirect Subclasses [AbortCountExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/AbortCountExceptionHandler), [ExponentialBackoffExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExponentialBackoffExceptionHandler), [IgnoreExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/IgnoreExceptionHandler) |-----------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AbortCountExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/AbortCountExceptionHandler) | Exception handler that is configured with a count of allowable retries before forcing an abort. | | [ExponentialBackoffExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExponentialBackoffExceptionHandler) | [ExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler) implementation that uses exponential backoff before retrying. | | [IgnoreExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/IgnoreExceptionHandler) | Exception handler that simply ignores all errors. | |||\n\nInterface for handling errors and defining a retry policy. \n\n### Public Method Summary\n\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [handleException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler#handleException(java.lang.Exception, int))(Exception ex, int ntries) Determines how to proceed after an exception is thrown. |\n\nPublic Methods\n--------------\n\n#### public abstract boolean\n**handleException**\n(Exception ex, int ntries)\n\nDetermines how to proceed after an exception is thrown.\n\nThe connector code passes the exception along with the number of attempts to the method.\nImplementations might call `Thread.sleep()` to delay or *back off* before\nreturning. \n\n##### Parameters\n\n| ex | the exception that occurred |\n| ntries | the number of consecutive failures for the current operation |\n|--------|--------------------------------------------------------------|\n\n##### Returns\n\n- `true` for an immediate retry or `false` to abort \n\n##### Throws\n\n| InterruptedException | if an interruption occurs during the *back off* |\n|----------------------|-------------------------------------------------|"]]