Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Removed BatchingException#toString() to only log total failure count
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulKQL committed Oct 9, 2019
1 parent 9930063 commit 65a9af8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
Expand Up @@ -226,7 +226,7 @@ private void addException(Throwable throwable) {

synchronized (errorLock) {
if (failureStatusCodeCount.containsKey(code)) {
failureStatusCodeCount.get(code).get();
failureStatusCodeCount.get(code).incrementAndGet();
} else {
failureStatusCodeCount.put(code, new AtomicInteger(1));
}
Expand Down
Expand Up @@ -29,7 +29,6 @@
*/
package com.google.api.gax.batching;

import com.google.api.gax.rpc.ApiException;
import com.google.api.gax.rpc.StatusCode;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
Expand All @@ -49,6 +48,8 @@ public class BatchingException extends RuntimeException {
long numOfFailure,
Map<Class, AtomicInteger> exceptionCount,
Map<StatusCode, AtomicInteger> statusCodeCount) {
super("Failed to commit " + numOfFailure + " mutations");

this.numOfFailure = numOfFailure;
this.exceptionCount = exceptionCount;
this.statusCodeCount = statusCodeCount;
Expand All @@ -65,23 +66,4 @@ public Map<Class, AtomicInteger> getFailureTypesCount() {
public Map<StatusCode, AtomicInteger> getFailureStatusCodeCount() {
return statusCodeCount;
}

@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("Failed to commit ")
.append(numOfFailure)
.append(" mutations\n")
.append("Mutations failed for Exception types: ")
.append(exceptionCount.entrySet())
.append("\n");

if (!exceptionCount.isEmpty()) {
sb.append("Total ApiException failure are: ")
.append(exceptionCount.get(ApiException.class))
.append(" with Status Code as: ")
.append(statusCodeCount.entrySet());
}
return sb.toString();
}
}

0 comments on commit 65a9af8

Please sign in to comment.