AbortCountExceptionHandler
Stay organized with collections
Save and categorize content based on your preferences.
Exception handler that is configured with a count of allowable retries before forcing an abort.
This is similar to the ExponentialBackoffExceptionHandler
except the wait time is
constant.
Public Constructor Summary
Public Method Summary
boolean
|
handleException(Exception e, int ntries)
Determines how to proceed when an exception is thrown.
|
Inherited Method Summary
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Public Constructors
public
AbortCountExceptionHandler
(int maximumTries, long sleepDuration, TimeUnit sleepUnit)
Constructs an AbortCountExceptionHandler.
Parameters
maximumTries |
number of retries to take if the traversal encounters exceptions |
sleepDuration |
the backoff time to wait between detected handler exceptions |
sleepUnit |
the TimeUnit for sleepDuration
|
Public Methods
public
boolean
handleException
(Exception e, int ntries)
Determines how to proceed when an exception is thrown.
Parameters
e |
occurring exception |
ntries |
number of previous failures |
Returns
- true to retry, false to abort (or rethrow exception)
Throws
InterruptedException |
on interruption
|
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,["# AbortCountExceptionHandler\n\npublic class **AbortCountExceptionHandler** extends Object \nimplements [ExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler) \nException handler that is configured with a count of allowable retries before forcing an abort.\n\nThis is similar to the [ExponentialBackoffExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExponentialBackoffExceptionHandler) except the wait time is\nconstant. \n\n### Public Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [AbortCountExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/AbortCountExceptionHandler#AbortCountExceptionHandler(int, long, java.util.concurrent.TimeUnit))(int maximumTries, long sleepDuration, TimeUnit sleepUnit) Constructs an AbortCountExceptionHandler. |\n\n### Public Method Summary\n\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| boolean | [handleException](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/AbortCountExceptionHandler#handleException(java.lang.Exception, int))(Exception e, int ntries) Determines how to proceed when an exception is thrown. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nFrom interface [com.google.enterprise.cloudsearch.sdk.ExceptionHandler](/workspace/cloud-search/docs/reference/sdk/com/google/enterprise/cloudsearch/sdk/ExceptionHandler) \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 Constructors\n-------------------\n\n#### public\n**AbortCountExceptionHandler**\n(int maximumTries, long sleepDuration, TimeUnit sleepUnit)\n\nConstructs an AbortCountExceptionHandler. \n\n##### Parameters\n\n| maximumTries | number of retries to take if the traversal encounters exceptions |\n| sleepDuration | the backoff time to wait between detected handler exceptions |\n| sleepUnit | the TimeUnit for sleepDuration |\n|---------------|------------------------------------------------------------------|\n\nPublic Methods\n--------------\n\n#### public boolean\n**handleException**\n(Exception e, int ntries)\n\nDetermines how to proceed when an exception is thrown. \n\n##### Parameters\n\n| e | occurring exception |\n| ntries | number of previous failures |\n|--------|-----------------------------|\n\n##### Returns\n\n- true to retry, false to abort (or rethrow exception) \n\n##### Throws\n\n| InterruptedException | on interruption |\n|----------------------|-----------------|"]]