Con il client Cloud Bigtable HBase per Java, entrambi i metodi possono generare un RetriesExhaustedWithDetailsException. Questa eccezione viene lanciata quando una o più operazioni batch non riescono per qualsiasi motivo (ad esempio, a causa di un errore di connessione). Contiene un elenco di richieste non riuscite, insieme ai dettagli dell'eccezione che ha causato il fallimento di ogni richiesta.
Un codice RetriesExhaustedWithDetailsException da solo non indica il motivo per cui una richiesta non è andata a buon fine. Devi chiamare
RetriesExhaustedWithDetailsException#getCauses() per recuperare le
eccezioni dettagliate per ogni richiesta non riuscita. Puoi quindi registrare informazioni su ciascuna delle eccezioni dettagliate, che ti aiuteranno a diagnosticare l'errore:
try {
mutator.mutate(mutationList);
} catch (RetriesExhaustedWithDetailsException e) {
for (Throwable cause : e.getCauses()) {
cause.printStackTrace();
}
throw e;
}
Un'eccezione può essere generata anche quando chiami
flush
o close.
Si applica la stessa gestione degli errori.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eThe HBase API allows batch operations through \u003ccode\u003eTable#batch\u003c/code\u003e and \u003ccode\u003eBufferedMutator#mutate\u003c/code\u003e, both of which can throw a \u003ccode\u003eRetriesExhaustedWithDetailsException\u003c/code\u003e if one or more operations fail.\u003c/p\u003e\n"],["\u003cp\u003eA \u003ccode\u003eRetriesExhaustedWithDetailsException\u003c/code\u003e alone doesn't specify the cause of failure; \u003ccode\u003eRetriesExhaustedWithDetailsException#getCauses()\u003c/code\u003e must be called to retrieve detailed exceptions for each failed request.\u003c/p\u003e\n"],["\u003cp\u003eExceptions during batch operations can be handled by iterating through the detailed exceptions provided by \u003ccode\u003egetCauses()\u003c/code\u003e to diagnose the failure.\u003c/p\u003e\n"],["\u003cp\u003eThe same exception handling process applies to errors that occur when calling \u003ccode\u003eflush\u003c/code\u003e or \u003ccode\u003eclose\u003c/code\u003e methods in batch operations.\u003c/p\u003e\n"]]],[],null,["Handle batch exceptions\n\nThe HBase API provides two ways to send multiple operations as a batch:\n\n- [`Table#batch(List, Object[])`](https://hbase.apache.org/2.5/apidocs/org/apache/hadoop/hbase/client/Table.html#batch-java.util.List-java.lang.Object:A-) combines multiple gets and mutations into a single batch.\n- [`BufferedMutator#mutate(List\u003c? extends Mutation\u003e mutations)`](https://hbase.apache.org/2.5/apidocs/org/apache/hadoop/hbase/client/BufferedMutator.html#mutate-java.util.List-) combines multiple mutations into a batch or series of batches.\n\nWith the Cloud Bigtable HBase client for Java, both of these methods can throw\na [`RetriesExhaustedWithDetailsException`](https://hbase.apache.org/2.5/apidocs/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.html). This exception is thrown\nwhen one or more of the batch operations fail for any reason (for example,\nbecause the connection failed). It contains a list of failed requests, along\nwith details about the exception that caused each request to fail.\n\nBy itself, a `RetriesExhaustedWithDetailsException` does not tell you why a\nrequest failed. You must call\n[`RetriesExhaustedWithDetailsException#getCauses()`](https://hbase.apache.org/2.5/apidocs/org/apache/hadoop/hbase/client/RetriesExhaustedWithDetailsException.html#getCauses--) to retrieve the\ndetailed exceptions for each failed request. You can then log information about\neach of the detailed exceptions, which will help you diagnose the failure: \n\n try {\n mutator.mutate(mutationList);\n } catch (RetriesExhaustedWithDetailsException e) {\n for (Throwable cause : e.getCauses()) {\n cause.printStackTrace();\n }\n throw e;\n }\n\nAn exception can also be thrown when you call\n[`flush`](https://hbase.apache.org/2.5/devapidocs/org/apache/hadoop/hbase/procedure/flush/package-summary.html)\nor [`close`](https://hbase.apache.org/2.5/apidocs/org/apache/hadoop/hbase/client/Connection.html#close--).\nThe same error handling applies."]]